Android examples for java.lang:Math Formula
Formula to calculate rectangle Area
import java.text.DecimalFormat; public class Main{ private static double result; public static double rectangleArea(double width, double height) throws InvalidInputException { if (width >= 0 && height >= 0) { result = (width * height);//from w w w . j a v a2 s .c o m return result; } else { throw new InvalidInputException(); } } }