- public class HelloJava {
- public static void main(String[] args)
- {
- // TODO 自动生成的方法存根
- int[] arr = {10,3,56,24,95,16,5,64};
- HelloJava sort = new HelloJava();
- sort.sort(arr);
- }
- public void sort(int[] array)
- {
- for(int i=1;i<array.length;i++)
- {
- for(int j=0;j<array.length-1;j++)
- {
- if(array[j] > array[j+1])
- {
- int temp = array[j];
- array[j]=array[j+1];
- array[j+1] = temp;
- }
- }
- }
- for(int x : array) {
- System.out.print(">" + x);
- }
- }
- }