Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sort arraylist bubble sort
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { ArrayList<Integer> A = new ArrayList<>(); A.add(34); A.add(4); A.add(43); A.add(32); for(Integer i:A){ System.out.print(i + " "); } System.out.println(); for(int i=0;i<A.size();i++){ for(int j=i+1;j<A.size();j++){ if(A.get(i) > A.get(j)){ int temp = A.get(i); A.set(i,A.get(j)); A.set(j,temp); } } } for(Integer i:A){ System.out.print(i + " "); } } }
run
|
edit
|
history
|
help
0
темп
Java recursive test
Has A
Ff
inheritance
Frequency
Marvel
Java Q4
Palindrome String Checking
checkingWord