public static boolean powerOf2(int num)
	{
		/**
		 * We first have to test if the number is negative usin a simple mask. If the number is negative then it can't be a power of 2.
		 * The key to having a power of 2 is that in binary there can only be one 1 in the entire number. A way to test this is to subtract
		 * one from the binary number, and then AND it with the original. If the answer isn't zero, then there has to be other one's and 
		 * thus it isn't a power of two. We add on another condition for the special case of zero, because zero isn't a power of 2.
		 */
		if((num & 0x80000000) != 0){
			return false;
		}
		return ((num & (num - 0x1)) == 0x0) && (num != 0);
	}