Java Number Power pow2(long x)

Here you can find the source of pow2(long x)

Description

Calculates 2 in power of integer value x

License

LGPL

Parameter

Parameter Description
x a parameter

Declaration

public static long pow2(long x) 

Method Source Code

//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;
    }
}

Related

  1. pow2(final int a)
  2. pow2(final int n)
  3. pow2(final int x)
  4. pow2(int c)
  5. pow2(int i)
  6. Pow2(Object in, double val)
  7. pow2ByteIndex(final int x)
  8. pow3_strict(final float a)
  9. pow4(double val)