Android examples for java.lang:Math Formula
Formula to calculate square Perimeter
import java.text.DecimalFormat; public class Main{ private static double result; public static double squarePerimeter(double side) throws InvalidInputException { if (side >= 0) { result = (4 * side);/*from w ww . j a v a 2 s .com*/ return result; } else { throw new InvalidInputException(); } } }