Here you can find the source of getSizeByHeight(int height, Image image)
public static int[] getSizeByHeight(int height, Image image)
//package com.java2s; import java.awt.Image; public class Main { public static int[] getSizeByHeight(int height, Image image) { int targetWidth = image.getWidth(null); int targetHeight = image.getHeight(null); long width = Math.round((targetWidth * height) / (targetHeight * 1.00f)); return new int[] { Integer.parseInt(String.valueOf(width)), height }; }/* w ww . ja va 2s . com*/ }