I have written code for insertion sort. I just want some feedback whether the above implementation is correct and can be improved.
public class InsertionSortNew {
static int temp;
public static void InsertionSort(int [] array){
for(int i =0;i<=array.length-1;i++){
int key = array[i];
for(int j=i-1;j>=0;j--){
if(key<array[j]){
temp = key;
array[j+1] = array[j];
array[j] = key;
key = array[j];
}else{
break;
}
}
}
}