Java Power of 2 nextPowerOfTwo(int value)

Here you can find the source of nextPowerOfTwo(int value)

Description

next Power Of Two

License

Apache License

Declaration

public static int nextPowerOfTwo(int value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int nextPowerOfTwo(int value) {
        return 1 << (32 - Integer.numberOfLeadingZeros(value - 1));
    }/* w  w w  .  j a v  a2  s . co m*/
}

Related

  1. nextPowerOfTwo(int n)
  2. nextPowerOfTwo(int num)
  3. nextPowerOfTwo(int value)
  4. nextPowerOfTwo(int value)
  5. nextPowerOfTwo(int value)
  6. nextPowerOfTwo(int x)
  7. nextPowerOfTwo(int x)
  8. nextPowerOfTwo(int x)
  9. nextPowerOfTwo(int x)