Java examples for java.lang:Math Calculation
next Power Of 2
//package com.java2s; public class Main { public static int nextPowerOf2(int n) { --n;//from w w w . j a v a 2 s.com n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; return (n | n >>> 16) + 1; } }