public static Size reduce(Size aspectRatio){
  BigInteger width=BigInteger.valueOf(aspectRatio.width());
  BigInteger height=BigInteger.valueOf(aspectRatio.height());
  BigInteger gcd=width.gcd(height);
  int numerator=Math.max(width.intValue(),height.intValue()) / gcd.intValue();
  int denominator=Math.min(width.intValue(),height.intValue()) / gcd.intValue();
  return new Size(numerator,denominator);
}

public static Size reduce ( Size aspectRatio ) { BigInteger width = BigInteger . valueOf ( aspectRatio . width ( ) ) ; BigInteger height = BigInteger . valueOf ( aspectRatio . height ( ) ) ; BigInteger gcd = width . gcd ( height ) ; int numerator = Math . max ( width . intValue ( ) , height . intValue ( ) ) / gcd . intValue ( ) ; int denominator = Math . min ( width . intValue ( ) , height . intValue ( ) ) / gcd . intValue ( ) ; return new Size ( numerator , denominator ) ; }
reduce an aspect ratio to its lowest common denominator . the ratio of the input and output sizes is guaranteed to be the same .
