MCPcopy Create free account
hub / github.com/badvision/jace / parseInt

Method parseInt

src/main/java/jace/cheat/MetaCheat.java:104–125  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

102 }
103
104 public int parseInt(String s) throws NumberFormatException {
105 if (s == null || s.isEmpty()) {
106 return 0;
107 }
108 if (s.matches("(\\+|-)?[0-9]+")) {
109 return Integer.parseInt(s);
110 } else {
111 String upper = s.toUpperCase();
112 boolean positive = !upper.startsWith("-");
113 for (int i = 0; i < upper.length(); i++) {
114 char c = upper.charAt(i);
115 if ((c >= '0' && c <= '9') || (c >= 'A' & c <= 'F')) {
116 int value = Integer.parseInt(s.substring(i), 16);
117 if (!positive) {
118 value *= -1;
119 }
120 return value;
121 }
122 }
123 }
124 throw new NumberFormatException("Could not interpret int value " + s);
125 }
126
127 @Override
128 public void registerListeners() {

Callers 10

MetaCheatMethod · 0.95
newSearchMethod · 0.95
performSearchMethod · 0.95
getValidAddressMethod · 0.80
runFileNamedMethod · 0.80
deserializeMethod · 0.80
parseGameControllerDBMethod · 0.80
setNameMethod · 0.80
fromStringMethod · 0.80
initializeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected