How would I add and subtract elements in an array? I want to add two elements that are in an array, take those elements out of the array, and add in the sum of those two elements into the array (so I take out 2 things from the array and add in one new one).
I've already tried google and the java sun forums to no avail. Any help would be greatly appreciated.
2007-02-24
16:03:55
·
4 answers
·
asked by
Galbadian
2
in
Computers & Internet
➔ Programming & Design
Thanks BK. I already tried that. Here's a little example. Let's say we have the array { 1, 3, 6, 7}. I want to sum up the two lowest (1 and 3) , delete the two lowest from the array (1 and 3), and then put that sum back into the array. So in this case I'd end up with {4,6,7}. If I keep going I'll get {10,7}, then {17}
2007-02-24
16:15:59 ·
update #1