Here you can find the source of bound(Point... points)
public static Rectangle bound(Point... points)
//package com.java2s; //License from project: Apache License import java.awt.*; public class Main { public static Rectangle bound(Point... points) { int smallestX = Integer.MAX_VALUE; int smallestY = Integer.MAX_VALUE; int largestX = Integer.MIN_VALUE; int largestY = Integer.MIN_VALUE; for (Point point : points) { if (point == null) { continue; }/* w w w . j a v a 2s . c o m*/ if (point.x > largestX) largestX = point.x; if (point.y > largestY) largestY = point.y; if (point.x < smallestX) smallestX = point.x; if (point.y < smallestY) smallestY = point.y; } return new Rectangle(smallestX, smallestY, largestX - smallestX, largestY - smallestY); } }