package com.heima.Coding;
//有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。
public class Test30 {
public static void main(String[] args) {
int[] arr = { 11, 22, 33, 44, 55, 66, 77, 88, 99 };
int num = 34;
int a[] = new int[arr.length + 1];
for (int i = 0; i < a.length-1; i++) {
if (num < arr[i] ){
int temp = arr[i] ;
a[i] = num ;
num = temp;
}else{
a[i]= arr[i];
}
}
a[a.length-1] = num ;
for (int i = 0; i < a.length; i++) {
System.out.print(a[i]+" ");
}
}
}