User:Wikieditor12103

sorting in java program

public class SortASC { public static void main (String args[]){ int[]arr = new int[]{5,2,8,7,1}; int temp; System.out.println("element of original array"); for(int i=0; i arr[j]){ temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }           }        }        System.out.println("element of array sorted"); for(int i=0; arr.length> i; i++){ System.out.println("arr[i]="+arr[i]); }    }    }