fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String args[]){
  11. int a[] = {1,22,5,16,7,9,12,16,18,30};
  12.  
  13.  
  14. for(int b=0; b<=a.length;b++){
  15. for(int c=0; c<=a.length-2;c++){
  16. if(a[c]>a[c+1]){
  17.  
  18. int temp=0;
  19. temp=a[c];
  20.  
  21. a[c]=a[c+1];
  22. a[c+1]=temp;
  23. }
  24. }
  25.  
  26. }
  27. for(int b=0;b<a.length;b++){
  28. System.out.println(a[b]);
  29. }
  30. }
  31. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
1
5
7
9
12
16
16
18
22
30