Formula to calculate square Perimeter - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate square Perimeter

Demo Code


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();
        }
    }
}

Related Tutorials