code: private static boolean isHexNumber(String value) {
        int index = (value.startsWith("-") ? 1 : 0);
        return (value.startsWith("0x", index) || value.startsWith("0X", index) || value.startsWith("#", index));
    }
docs: Determine whether the given value String indicates a hex number, i.e. needs to be
  passed into <code>Integer.decode</code> instead of <code>Integer.valueOf</code> (etc).