Android examples for java.lang:Math Formula
Formula to calculate square Area
import java.text.DecimalFormat; public class Main{ private static double result; public static double squareArea(double side) throws InvalidInputException { if (side >= 0) { result = (side * side);// w w w .ja v a 2s . c o m return result; } else { throw new InvalidInputException(); } } }