Here you can find the source of hitTest(BufferedImage image, int x, int y)
public static boolean hitTest(BufferedImage image, int x, int y)
//package com.java2s; // under the terms of the GNU Lesser General Public License as published import java.awt.image.BufferedImage; public class Main { /**// w w w .j ava2 s . c o m * Returns true if the supplied image contains a non-transparent pixel * at the specified coordinates, false otherwise. */ public static boolean hitTest(BufferedImage image, int x, int y) { // it's only a hit if the pixel is non-transparent int argb = image.getRGB(x, y); return (argb >> 24) != 0; } }