Here you can find the source of ceilPowerOf2(int x)
Parameter | Description |
---|---|
x | a parameter |
public static final int ceilPowerOf2(int x)
//package com.java2s; public class Main { /**/*from w w w.ja v a 2s . c om*/ * Rounds up the value to the nearest higher power^2 value. * * @param x * @return power^2 value */ public static final int ceilPowerOf2(int x) { int pow2 = 1; while (pow2 < x) { pow2 <<= 1; } return pow2; } }