Android examples for java.lang:Math Formula
Formula to calculate cylinder Surface
import java.text.DecimalFormat; public class Main{ private static final double PI = 3.141592653589793; private static double result; public static double cylinderSurface(double radius, double height) throws InvalidInputException { if (radius >= 0 && height >= 0) { result = (2 * radius * radius * PI) + (2 * radius * height * PI); return result; } else {//from w ww . j av a 2 s . c om throw new InvalidInputException(); } } }