+ 1
How to print array [1,0,5,0,6,7,2,0] and result is 1,2,5,6,7,0,0,0 in java
array sorting
5 odpowiedzi
+ 2
First do a array.sort(); so everything will be sorted (with the 0 first), then, foreach values in your array, if this value at the index "i = 0" and the the value at index "i + 1 != 0" invert them using per exemple a temp var --> save value of index "i" in temp, set value of index i + 1 at index i and then put value of temp in the i + 1 index. I don't have time to code it right now (and no ide atm) but I can put the code here later. Try your best :)
+ 2
java
+ 1
help me
+ 1
Which language?
+ 1
thanks i try