r2.x = rect.x + ((sides & LEFT) == 0 ? 0 : border.left); r2.width = rect.width - ((sides & LEFT) == 0 ? 0 : border.left) - ((sides & RIGHT) == 0 ? 0 : border.right); r2.y = rect.y + ((sides & TOP) == 0 ? 0 : border.top); r2.height = rect.height - ((sides & TOP) == 0 ? 0 : border.top) - ((sides & BOTTOM) == 0 ? 0 : border.bottom);
r2.x = rect.x + ((sides & LEFT) == 0 ? 0 : (int)border.left()); r2.width = rect.width - ((sides & LEFT) == 0 ? 0 : (int)border.left()) - ((sides & RIGHT) == 0 ? 0 : (int)border.right()); r2.y = rect.y + ((sides & TOP) == 0 ? 0 : (int)border.top()); r2.height = rect.height - ((sides & TOP) == 0 ? 0 : (int)border.top()) - ((sides & BOTTOM) == 0 ? 0 : (int)border.bottom());
    public static Rectangle shrinkRect(final Rectangle rect, final Border border, int sides) {        Rectangle r2 = new Rectangle();        r2.x = rect.x + ((sides & LEFT) == 0 ? 0 : border.left);        r2.width = rect.width - ((sides & LEFT) == 0 ? 0 : border.left) - ((sides & RIGHT) == 0 ? 0 : border.right);        r2.y = rect.y + ((sides & TOP) == 0 ? 0 : border.top);        r2.height = rect.height - ((sides & TOP) == 0 ? 0 : border.top) - ((sides & BOTTOM) == 0 ? 0 : border.bottom);        return r2;    }