Android examples for java.lang:Math Formula
Formula to calculate circle Area
import java.text.DecimalFormat; public class Main{ private static final double PI = 3.141592653589793; private static double result; public static double circleArea(double radius) throws InvalidInputException { if (radius >= 0) { result = radius * radius * PI; return result; } else {//from ww w.jav a2 s .c o m throw new InvalidInputException(); } } }