Here you can find the source of pow2(final int x)
Parameter | Description |
---|---|
x | power |
public static int pow2(final int x)
//package com.java2s; /**// ww w .ja va 2s .c o m * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ public class Main { /** * Simple 2^x * * @param x * power * @return 2^x */ public static int pow2(final int x) { if (x <= 0) { return 1; } return 2 << x - 1; } }