Java Fraction Create frac(double x)

Here you can find the source of frac(double x)

Description

Returns the fractional part of x, that is, the part behind the decimal dot.

License

Open Source License

Parameter

Parameter Description
x The real number

Return

The fractional part of x

Declaration

public static int frac(double x) 

Method Source Code

//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("^.*\\.", ""));
    }
}

Related

  1. frac(double number)
  2. Frac(double value)
  3. frac(double value)
  4. Frac(double x)
  5. frac(float x)
  6. frac(int f)
  7. fraction(double decimal, double tolerance)