Here you can find the source of expand(Rectangle rect, int amount)
public static Rectangle expand(Rectangle rect, int amount)
//package com.java2s; //License from project: Apache License import java.awt.*; public class Main { public static Rectangle expand(Rectangle rect, int amount) { return new Rectangle(rect.x - amount, rect.y - amount, rect.width + amount * 2, rect.height + amount * 2); }//from ww w .ja va 2 s. c o m }