java program printsquare

Solutions on MaxInterview for java program printsquare by the best coders in the world

showing results for - "java program printsquare"
Matthew
04 Aug 2018
1/*
212345
323451
434512
545123
651234
7*/
8public static void printSquare(int[]a){
9           int temp;
10            for (int i = 0; i < a.length; i++) {
11                for(int k = 0; k<a.length; k++){
12                System.out.print(a[k]);
13                }
14                System.out.println();
15                temp=a[0];
16                for(int j=0;j<a.length-1;j++)    
17                    a[j]=a[j+1];
18                a[a.length-1]=temp;
19            }
20    }
21