Appium - Get RGBA Color code of specific Point in UI in Appium

public static int getColor(int xCord, int yCord, String imagePath)
{
BufferedImage img = null;
File f = null;

f = new File(imagePath);
try {
img = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
}

int width = img.getWidth();
int height = img.getHeight();

int color = img.getRGB(x,y);

return color;
}

@SuppressWarnings("deprecation")
public static void validateColor(int xCord, int yCord, String imagePath)
{
int color = getColor(xCord, yCord, path);

//get alpha
int actualAlpha = (color>>24) & 0xff;

//get red
int actualRed = (color>>16) & 0xff;

//get green
int actualGreen = (color>>8) & 0xff;

//get blue
int actualBlue = color & 0xff;
}