Java Double Number Round round2(double d)

Here you can find the source of round2(double d)

Description

Useful for hashCode() and equals() fn's that compare stuff read from a text file.

License

Open Source License

Declaration

public static int round2(double d) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* ww  w . j  ava  2  s .  c o m*/
     * Useful for hashCode() and equals() fn's that compare stuff read from a text file.
     * Here we round an integer to the nearest cent and return the number of cents.
     */
    public static int round2(double d) {
        return (int) (d * 100 + 0.5);
    }
}

Related

  1. round(final double val, final int decimals)
  2. round(final Double value)
  3. round(final Double value)
  4. round(final double value, final int numDecimals)
  5. round(final double x, final int digits)
  6. round2(double num)
  7. round2(final double arg)
  8. round2(int a, int preserveDigits)
  9. round2Places(Double input)