Here you can find the source of frac(double x)
Parameter | Description |
---|---|
x | The real number |
public static int frac(double x)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w.jav a 2 s . co m*/ * Returns the fractional part of x, that is, the part behind the decimal * dot. * * @param x The real number * @return The fractional part of x */ public static int frac(double x) { return Integer.parseInt(String.valueOf(x).replaceAll("^.*\\.", "")); } }