is Power Of Two - Android java.lang

Android examples for java.lang:Math

Description

is Power Of Two

Demo Code

/*//from   w  w w. j a  v  a 2s.  co  m
 * Copyright (c) 2012-2013 OrangeSignal.com All Rights Reserved.
 */
//package com.java2s;

public class Main {

    public static boolean isPowerOfTwo(final int value) {
        if (value != 0) {
            return (value & -value) == value;
        }
        return false;
    }
}

Related Tutorials