public static void main(String[] args) {
		int sum = 0;
		for (int i = 0; i < 1000000; i++)
			// check if base 10 is palindromic
			if (isPalindrome(i))
				// check if base 2 is palindromic
				if (!(Integer.numberOfLeadingZeros(i) > 0 && Integer
						.numberOfTrailingZeros(i) > 0))
					/*
					 * NOTE: Solution can be made faster by converting directly
					 * to binary number instead of to a string. Search the Java
					 * API to find a means.
					 */
					if (isPalindrome(Integer.toBinaryString(i)))
						sum += i;
		System.out.println(sum);
		// Solution: 872187
	}