📄 sort.java
字号:
public class sort {
public static void main(String[] args) {
int[] array = {2,4,5,3,1,6};
int temp =0;
for(int i =0;i<6;i++){
temp = array[array[i]-1];
array[array[i]-1]=array[i] ;
array[i]= temp;
//temp = array[i];
//array[i] = array[array[i]-1];
//array[array[i]-1]= temp;
}
System.out.println("The sorted array is:");
for(int i =0;i<6;i++){
System.out.println(array[i]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -