public void rotate(int[][] matrix) {
        int length  = matrix.length;
        int[][] array = new int[length][length];
        for(int i =0;i < length;i++){
            for(int j =0;j<length;j++){
                array[j][length-1-i] = matrix[i][j] ;
            }
        }

        for(int i =0;i < length;i++){
            for(int j =0;j<length;j++){
                matrix[i][j] =array[i][j];
            }
        }
    }