Skip to content

Commit

Permalink
Added ability to parse negative hex numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
aalesv authored and dschultzca committed Jun 12, 2024
1 parent 69535ec commit bd77db3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/main/java/com/romraider/util/HexUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ public static void hexToBytes(String s, byte[] out, int off) throws NumberFormat
* @return integer value
*/
public static int hexToInt(String input) {
if (input.length() > 2 && input.substring(0, 2).equalsIgnoreCase("0x")) {
return Integer.parseInt(input.substring(2), 16);
} else {
return Integer.parseInt(input, 16);
}
return Integer.parseInt(input.replace("0x",""), 16);
}

/**
Expand Down

0 comments on commit bd77db3

Please sign in to comment.