hi ,
i did Sort class and i did many method for this class such as swap ,min and sortArr. I have difficulty in solve a this static method which is; a method that returns true if the array arr is sorted, otherwise it returns false.
I start like that...
1)
public static boolean isSorted(int[] arr, int i){
for(int i=0;i< arr.length-1;i++){
if ( arr [i]>arr [i++]); return false;
}
} it is not compile and also i feel that my answer is wrong ..
2)and if I want to reverse the number for example I have 1 2 3 4 and the result should be 4 3 2 1
,so can you help me to understand this question and explain to me how to write these code
i did Sort class and i did many method for this class such as swap ,min and sortArr. I have difficulty in solve a this static method which is; a method that returns true if the array arr is sorted, otherwise it returns false.
I start like that...
1)
public static boolean isSorted(int[] arr, int i){
for(int i=0;i< arr.length-1;i++){
if ( arr [i]>arr [i++]); return false;
}
} it is not compile and also i feel that my answer is wrong ..
2)and if I want to reverse the number for example I have 1 2 3 4 and the result should be 4 3 2 1
,so can you help me to understand this question and explain to me how to write these code
Comment