Java Double Number Round round(final double v)

Here you can find the source of round(final double v)

Description

Rounds the given number to a precision of two after digit numbers.

License

Open Source License

Parameter

Parameter Description
v number

Return

rounded number

Declaration

public static double round(final double v) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Ubiquitous Knowledge Processing Lab
 * /*ww  w. j  a va  2  s  .c o m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v3
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl.html
 * 
 * Project Website:
 *    http://jwpl.googlecode.com
 * 
 * Contributors:
 *    Torsten Zesch
 *    Simon Kulessa
 *    Oliver Ferschke
 ******************************************************************************/

public class Main {
    /**
     * Rounds the given number to a precision of two after digit numbers.
     * 
     * @param v
     *            number
     * @return rounded number
     */
    public static double round(final double v) {
        return ((long) (v * 100.)) / 100.;
    }
}

Related

  1. round(double[] array, int decimals)
  2. round(double[][] data)
  3. round(final double num)
  4. round(final double num, final int prec)
  5. round(final double numberToRound, final int decimalPlaces)
  6. round(final double val, final int decimalPlaces)
  7. round(final double val, final int decimals)
  8. round(final Double value)
  9. round(final Double value)