Java tutorial
//package com.java2s; import java.math.BigDecimal; public class Main { private static BigDecimal findRatio(int width, int height) { BigDecimal bdWidth = BigDecimal.valueOf(width); BigDecimal bdHeight = BigDecimal.valueOf(height); return bdWidth.divide(bdHeight, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(1000L)); } }