Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sorting array
//'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 sortingArray(int []a){ for(int i=0;i<a.length-1;i++){ for(int j=0;j<a.length-1;j++){ if(a[j]>a[j+1]){ int temp=a[j+1]; a[j+1]=a[j]; a[j]=temp; } } } for(int i=0;i<a.length;i++){ System.out.println("array is"+a[i]); } } public static void main(String args[]) { int a[]={2,5,3,4,6,1}; sortingArray(a); } }
run
|
edit
|
history
|
help
0
qwe
Klamry dla Andy'ego
thư viện
Table for 20
Tree ZigZag Traversal
jb11.0 threads tick tock
exp5
Java - Swap two numbers without using temp var
quickSort_LinkedList
ElaineBrown**