public static int check(Point point, Rectangle bounds) {
        int value = 0;
        if (point.x == bounds.left) {
            value |= LEFT;
        }
        if (point.x == bounds.right) {
            value |= RIGHT;
        }
        if (point.y == bounds.top) {
            value |= TOP;
        }
        if (point.y == bounds.bottom) {
            value |= BOTTOM;
        }
        return value;
    }