private int getMinOrMax(BufferedImage img, int x, int y, int[][] shape, boolean erote) { // Initializing min and max values int minimum = Integer.MAX_VALUE; int maximum = Integer.MIN_VALUE; // Getting dimension of the image int width = img.getWidth(); int height = img.getHeight(); for(int i = 0; i=0 && checkX=0 && checkYmaximum) maximum = rgb; } } } } if(erote) return minimum; else return maximum; }