private static Shape scale(final Shape currentPolygon,final double xScaleFactor,final double yScaleFactor){
  final Point2D centroid=getCentroid(currentPolygon);
  final AffineTransform transform=AffineTransform.getTranslateInstance((1.0 - xScaleFactor) * centroid.getX(),(1.0 - yScaleFactor) * centroid.getY());
  transform.scale(xScaleFactor,yScaleFactor);
  final Shape shape=transform.createTransformedShape(currentPolygon);
  return shape;
}

private static Shape scale ( final Shape currentPolygon , final double xScaleFactor , final double yScaleFactor ) { final Point2D centroid = getCentroid ( currentPolygon ) ; final AffineTransform transform = AffineTransform . getTranslateInstance ( ( 1.0 - xScaleFactor ) * centroid . getX ( ) , ( 1.0 - yScaleFactor ) * centroid . getY ( ) ) ; transform . scale ( xScaleFactor , yScaleFactor ) ; final Shape shape = transform . createTransformedShape ( currentPolygon ) ; return shape ; }
from : eu . hansolo . steelseries . tools . scaler . java returns a scaled version of the given shape , calculated by the given scale factor . the scaling will be calculated around the centroid of the shape .
