Here you can find the source of nextPower(int v, int power)
public static int nextPower(int v, int power)
//package com.java2s; public class Main { public static int nextPower(int v, int power) { int result = 1; while (result < v) { result *= power;/*from w ww . j a v a 2 s.c o m*/ } return result; } }