Java Double Number Round RoundDown(final T number)

Here you can find the source of RoundDown(final T number)

Description

Returns a long number by round down with specify number.
Returns 0 if number == null.
e.g: average is 3.5, then return 3.

License

Apache License

Parameter

Parameter Description
number number to be handled.

Return

a long number by round down with specify number.

Declaration

public static <T extends Number> long RoundDown(final T number) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from  ww  w . j  a  va2s  .  c o m
     * Returns a long number by round down with specify number.<br>
     * Returns 0 if number == null.<br>
     * e.g: average is 3.5, then return 3.
     * 
     * @param number
     *            number to be handled.
     * @return a long number by round down with specify number.
     */
    public static <T extends Number> long RoundDown(final T number) {

        if (number == null) {
            return 0;
        }
        return number.longValue();
    }
}

Related

  1. roundDown(double num)
  2. roundDown(double val, int decimals)
  3. roundDown(double value, double units)
  4. roundDown(double value, int gridSize)
  5. roundDown(final float realNumber)
  6. roundDown(int n, int m)
  7. roundDown(int number, int mod)
  8. roundDown(int val, int shift)
  9. roundDown(int val, int to)