Java Number Round roundup_2n(long val, int blocksize)

Here you can find the source of roundup_2n(long val, int blocksize)

Description

Round up a value to the next multiple of a power of 2

License

GNU General Public License

Declaration

private static long roundup_2n(long val, int blocksize) 

Method Source Code

//package com.java2s;
/* This code is part of Freenet. It is distributed under the GNU General
 * Public License, version 2 (or at your option any later version). See
 * http://www.gnu.org/ for further details of the GPL. */

public class Main {
    /** Round up a value to the next multiple of a power of 2 */
    private static long roundup_2n(long val, int blocksize) {
        int mask = blocksize - 1;
        return (val + mask) & ~mask;
    }/*from   w w  w.ja v a 2 s . com*/
}

Related

  1. roundUp(long n, long m)
  2. roundUp(long number, long mod)
  3. roundUp(long position, long sectionAlignment)
  4. roundUp(long size, int blockSize)
  5. roundUp(long val, long delta)
  6. roundUpDivision(final int dividend, final int divider)
  7. roundUpDown(int number, int by)
  8. roundUpIfNecessary(long timeout, long convertedTimeout)
  9. roundUpLong(long value, long interval)