How do I get whole and fractional parts from double in JSP/Java?
double value = 3.25;
double fractionalPart = value % 1;
double integralPart = value - fractionalPart;
http://www.java2s.com/Code/Java/Data-Type/Obtainingtheintegerandfractionalparts.htm
double num;
long iPart;
double fPart;
// Get user input
num = 2.3d;
iPart = (long) num;
fPart = num - iPart;
System.out.println("Integer part = " + iPart);
System.out.println("Fractional part = " + fPart);
Outputs:
Integer part = 2
Fractional part = 0.2999999999999998