public int[][] makeReflection(int img[][], int kernel) {

        for (int i = 0; i < img.length; i++) {

            for (int j = 0; j < img[i].length; j++) {

                //---- Top ----//
                if (i == 0) {
                    int a = i+2;
                    //if(a>9) a=9;
                    if(a>img.length) a=img.length;
                    img[i][j] = img[a][j];
                    
                } //---- Left ----//
                else if ((i != 0) && (j == 0)) {
                    int a = j+2;
                    img[i][j] = img[i][a];
                    
                } //---- Bottom -----//
                else if (i == img.length - 1) {
                    int a = i-2;
                    img[i][j] = img[a][j];
                    
                } //---- Right ----//
                else if ((i > 0) && (j == img.length-1)) {
                    int a = j-2;
                    img[i][j] = img[i][a];
                    
                }
                //----- inside ----//
                else {
                    //System.out.format("%3s ", "x");
                    //System.out.format("%3d ", img[i][j]);
                }
            }
        }
        
        //--- LeftTop Corner ---//
        img[0][0] = img[kernel-1][kernel-1];
        
        //---- LeftBottom Corner ---//
        img[img.length-1][0] = img[img.length-1][kernel-1];

        //--- RightTop Corner ---//
        img[0][img.length-1] = img[kernel-1][img.length-1];

        //--- RightBottom Corner ---//
        img[img.length-1][img.length-1] = img[img.length-3][img.length-3];   
        
        return img;
    }