Java tutorial
//package com.java2s; import java.math.BigDecimal; public class Main { public static String cm2FT_IN(float paramFloat) { int i = (int) (paramFloat / 30.48F); int j = Math.round(12.0F * (paramFloat / 30.48F - i)); return i + "'" + j + "\""; } public static double round(double paramDouble, int paramInt) { if (paramInt < 0) { throw new IllegalArgumentException("The scale must be a positive integer or zero"); } return new BigDecimal(Double.toString(paramDouble)).divide(new BigDecimal("1"), paramInt, 5).doubleValue(); } }