Java Ceil ceilingNextPowerOfTwo(final int x)

Here you can find the source of ceilingNextPowerOfTwo(final int x)

Description

ceiling Next Power Of Two

License

Open Source License

Declaration

public static int ceilingNextPowerOfTwo(final int x) 

Method Source Code

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

public class Main {

    public static int ceilingNextPowerOfTwo(final int x) {
        return 1 << (32 - Integer.numberOfLeadingZeros(x - 1));
    }//  w  w w  .j a  va 2 s  .co  m
}

Related

  1. ceiling(double d)
  2. ceiling(double d)
  3. ceiling_float_int(float value)
  4. ceilingAbs(double a)
  5. ceilingHalf(int num)
  6. ceilingPow2(int n)
  7. ceilingPowerOf2(final int n)
  8. ceilingPowerOf2(int n)
  9. ceilingPowerOfTwo(final int a)