private static BigInteger decodeMagnitude(int p, String s) {
		// Special case, so it doesn't get chewed by octal parser
		if ("0".equals(s)) {
			return BigInteger.ZERO;
		}
		if (s.regionMatches(true, p, HEX_PREFIX_X, 0, HEX_PREFIX_X.length())) {
			return new BigInteger(s.substring(p + HEX_PREFIX_X.length()), 16);
		}
		if (s.regionMatches(true, p, BIN_PREFIX, 0, BIN_PREFIX.length())) {
			return new BigInteger(s.substring(p + BIN_PREFIX.length()), 2);
		}
		// Check last, because prefix is shortest.
		if (s.regionMatches(true, p, OCT_PREFIX, 0, OCT_PREFIX.length())) {
			return new BigInteger(s.substring(p + OCT_PREFIX.length()), 8);
		}
		return new BigInteger(s.substring(p), 10);
	}
Parses the given decimal/hex string as a custom type. This method allows values with the top 
bit set to be implicitly parsed as negative values.

@param s the string to parse
@param forceHex true if the string to parse should be treated as hex, even if it doesn't 
  start with {@code 0x}; otherwise, false;
@param func a {@link Function} used to convert the parsed {@link BigInteger} to a custom type
@param max the maximum value that can be used to represent the type of value being parsed if
  it were treated as unsigned
@param <T> The type of value being parsed
@return the parsed value
@throws NumberFormatException if the string does not represent a valid value
Ghidra/Framework/Generic/src/main/java/ghidra/util/NumericUtilities.java