Android examples for java.lang:Math Formula
Formula to calculate prism Volume
import java.text.DecimalFormat; public class Main{ private static double result; public static double prismVolume(double length, double width, double height) throws InvalidInputException { if (length >= 0 && width >= 0 && height >= 0) { result = (length * width * height); return result; } else {//from w w w . ja v a2 s . com throw new InvalidInputException(); } } }