Android examples for java.lang:Math Formula
Formula to calculate triangle Perimeter
import java.text.DecimalFormat; public class Main{ private static double result; public static double trianglePerimeter(double base, double side1, double side2) throws InvalidInputException { if (base >= 0 && side1 >= 0 && side2 >= 0) { result = (base + side1 + side2); return result; } else {//from ww w .j av a2s . c o m throw new InvalidInputException(); } } }