Java Number Round roundToQuarterMs(float f)

Here you can find the source of roundToQuarterMs(float f)

Description

rounds to nearest increment of 0.25

License

BSD License

Parameter

Parameter Description
f a parameter

Declaration

public static float roundToQuarterMs(float f) 

Method Source Code

//package com.java2s;
// LICENSE:      This file is distributed under the BSD license.

public class Main {
    /**//w w w. j a  v a 2s .  c  o  m
     * rounds to nearest increment of 0.25
     * @param f
     * @return
     */
    public static float roundToQuarterMs(float f) {
        return ((float) Math.round(f * 4)) / 4;
    }
}

Related

  1. roundToPowerOf(int i, int powerOf)
  2. roundToPowerOf10(double value, int powerOf10)
  3. roundToPowerOf2(int value)
  4. roundToPrecision(double number, int precision)
  5. roundToPrecision(float value, int numDecimalPlaces)
  6. roundToShort(final double d)
  7. roundToSignificantDigits(double num, int n)
  8. roundToSignificantDigits(double value, int n)
  9. roundToSignificantDigits(double x, double y, int nSignif)