fun nextPowerOf2(x: Int): Int { var i: Long = 1 while (i < x && i < Int.MAX_VALUE / 2) { i += i } return i.toInt() }
Get the value that is equal or higher than this value , and that is a power of two .