Here you can find the source of pow2(long x)
x
Parameter | Description |
---|---|
x | a parameter |
public static long pow2(long x)
//package com.java2s; //License from project: LGPL public class Main { /**/* w w w.j a v a 2s .co m*/ * Calculates 2 in power of integer value <code>x</code> * * @param x */ public static long pow2(long x) { long result = 1; for (long i = 1; i <= x; i++) { result *= 2; } return result; } }