Write some java array code that can clear my concept | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write some java array code that can clear my concept

Java array programs

3rd Nov 2018, 3:42 PM
Basit Mir
Basit Mir - avatar
8 Answers
+ 2
You should share where you are having problems. https://www.sololearn.com/learn/Java/2148/
3rd Nov 2018, 5:43 PM
Roneel
Roneel - avatar
+ 2
AlphaOne he can add Collections.reverseOrder() Like Arrays.sort(array, Collections.reverseOrder());
3rd Nov 2018, 6:37 PM
Michal
Michal - avatar
+ 2
I never knew that. thanks for the info Michal.
3rd Nov 2018, 6:39 PM
Lambda_Driver
Lambda_Driver - avatar
+ 2
this is an implementation of what master Michal mentioned. take note that this only works on objects and not primitive types like int. you need to convert each primitive type to their respective object counterpart. (e.g. Integer for int, Double for double, Boolean for boolean, etc.) https://code.sololearn.com/c8ozt72h4EpZ/?ref=app
3rd Nov 2018, 7:49 PM
Lambda_Driver
Lambda_Driver - avatar
+ 2
Exactly, you can do just like AlphaOne mentioned. Just some complete from me. https://code.sololearn.com/cd1B24Q01IfP/?ref=app
3rd Nov 2018, 8:16 PM
Michal
Michal - avatar
+ 1
Basit Mir do you have to implement your method? If you can use something already done you can use "Arrays"
3rd Nov 2018, 6:24 PM
Michal
Michal - avatar
+ 1
Basit Mir there is a built-in sort method in Arrays. Arrays.sort(yourArray) it only sorts in ascending order. if you need to create your own algorithm, then read up on sorting algorithms here at SoloLearn
3rd Nov 2018, 6:34 PM
Lambda_Driver
Lambda_Driver - avatar
0
I have to create a program ascending and descending order using java array
3rd Nov 2018, 5:46 PM
Basit Mir
Basit Mir - avatar