int[] mArray = new int[5];
for( int newFlag = 0; ; newFlag ++ ){
int flag = newFlag%5;
System.out.print("请输入: ");
int input = new Scanner(System.in).nextInt();
if( input == 0 ) break;
mArray[flag] = input;
for( int i = flag+1; i < 5; i ++ ) System.out.print(mArray[i]+" ");
for( int i = 0; i < flag+1; i ++ ) System.out.print(mArray[i]+" ");
System.out.println();
}
//newIndex新的数,index需要现在显示的第几个数
int select; //index下标
if (newIndex + index <= 4) select = index + newIndex;
else select = index + NewIndex - 5;