Here you can find the source of minPower2(int n)
public static int minPower2(int n)
//package com.java2s; /**/*w w w . ja v a 2 s. c o m*/ * Utilities to link BIJ things to ImageJ. * * Copyright (c) 1999-2004, Michael Abramoff. All rights reserved. * @author: Michael Abramoff * * Small print: * This source code, and any derived programs ('the software') * are the intellectual property of Michael Abramoff. * Michael Abramoff asserts his right as the sole owner of the rights * to this software. * Commercial licensing of the software is available by contacting the author. * THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ public class Main { /** * Find the minimal power of 2 that is larger than n. * @return the minimal power of 2 that larger than n. */ public static int minPower2(int n) { int newn = 2; while (newn < n) newn *= 2; return newn; } }