static double[][] flipdim(double[][] a,int deg){ //正確
        int row = a.length;

        double[][] result = new double[row][];
        if(deg==1){
            for(int i=0;i<row;i++){
                result[i] = a[row-i-1];
            }
        }else if(deg==2){
            for(int i=0;i<row;i++){
                int col = a[i].length;
               result[i] = new double[col];
                for(int j =0;j<col;j++){
                    result[i][j] = a[i][col-j-1];
                }
            }
        }
        return result;
    }