Java Number Round roundFileLength(long nbytes)

Here you can find the source of roundFileLength(long nbytes)

Description

round File Length

License

Open Source License

Parameter

Parameter Description
nbytes a parameter

Declaration

public static long roundFileLength(long nbytes) 

Method Source Code

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

public class Main {
    /**/*from  w w  w  .ja v  a  2s  .  c o m*/
     * @param nbytes
     * @return
     * @see default 'io.bytes.per.checksum' property
     */
    public static long roundFileLength(long nbytes) {
        if (nbytes <= 0)
            return 0;
        else if (nbytes <= 512)
            return nbytes;
        else if (nbytes % 512 == 0)
            return nbytes;
        else
            return (int) (nbytes / 512 + 1) * 512;
    }
}

Related

  1. roundedLog(double value, double exponent)
  2. roundedLog10(int n)
  3. roundedSatisfaction(double value)
  4. rounder(float value, int digits)
  5. roundf(float value)
  6. roundFloat(float value, int afterDecimalPoint)
  7. roundFloatToPlace(float f, int place)
  8. roundFloatToUnitInverse(final float graphValue, final float graphUnit)
  9. roundFormat(final int numPrec, final double number)