View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package net.sf.zel.math;
7   
8   /**
9    *
10   * @author zoly
11   */
12  public final class MathUtil {
13  
14      private MathUtil() {}
15  
16      public static int closestPowerOf2(final int number)
17      {
18          int capacity = 1;
19          while (capacity < number)
20              capacity <<= 1;
21          return capacity;
22      }
23  }