Here you can find the source of boundingTest(Polygon p, int x, int y, int w, int h)
public static boolean boundingTest(Polygon p, int x, int y, int w, int h)
//package com.java2s; //License from project: Apache License import java.awt.Polygon; import java.awt.Rectangle; public class Main { private static Rectangle rect = new Rectangle(0, 0, 0, 0); public static boolean boundingTest(Polygon p, int x, int y, int w, int h) { rect.setBounds(x, y, w, h);/*ww w.j a v a 2s .co m*/ return p.intersects(rect); } }