Formula to calculate ellipsoid Volume - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate ellipsoid Volume

Demo Code


import java.text.DecimalFormat;

public class Main{
    private static final double PI = 3.141592653589793;
    private static double result;
    public static double ellipsoidVolume(double radius1, double radius2,
            double radius3) throws InvalidInputException {
        if (radius1 >= 0 && radius2 >= 0 && radius3 >= 0) {
            result = ((4 * PI * radius1 * radius2 * radius3) / 3);
            return result;
        } else {// w  ww.  j  a  va  2 s. c  o m
            throw new InvalidInputException();
        }
    }
}

Related Tutorials