Java examples for java.lang:Math Convert
Convert Centimeters to Inches.
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { double cm = 2.45678; System.out.println(calculateInches(cm)); }// ww w .ja v a2 s . c o m /** * Convert Centimeters to Inches. * @param cm The centimeters to convert to inches. * @return Returns the converted value. */ public final static float calculateInches(double cm) { return (float) (cm * 0.39); } }