Please check this program that sorts an integer array.  It doesn't look very efficient.  Please tell me how to correct this.int temp;for(int i=0;i<nums.length-1;i++){    if(nums[i]>nums[i+1])// if this is true, swap the value    {        temp=nums[i];        nums[i]=nums[i+1];        nums[i+1]=temp;        i=-1;//If there is swap happen, loop will start again from 0th element    }}
Sorting integer array
java;optimization;sorting