Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Java initialization shaping array
Java initialization shaping array
Public class TestMaxAndMin {

Public static void main(String[] args) {

int[]arr = new int[ 10];

arr[0]= 12;

arr[ 1]= 13;

arr[2]= 14;

arr[3]= 15;

arr[4]= 16;

arr[5]= 17;

arr[6]= 18;

arr[7]= 19;

arr[8]= 23;

arr[9]= 22;

for(int I = 0; I< arr. length-1; i++){

Internal temperature;

for(int j = 0; J< array length-I-1; j++){

if(arr[j]& gt; arr[j+ 1]){

temp = arr[j];

arr[j]= arr[j+ 1];

arr[j+ 1]= temp;

}

}

}

For (integer h:arr){

system . out . println(h);

}

}

}

It's sort, it's bubble sort, the first one is the smallest and the last one is the largest.