01: package org.bouncycastle.util.test;
02:
03: /**
04: * Parsing
05: */
06: public final class NumberParsing {
07: private NumberParsing() {
08: // Hide constructor
09: }
10:
11: public static long decodeLongFromHex(String longAsString) {
12: if ((longAsString.charAt(1) == 'x')
13: || (longAsString.charAt(1) == 'X')) {
14: return Long.parseLong(longAsString.substring(2), 16);
15: }
16:
17: return Long.parseLong(longAsString, 16);
18: }
19:
20: public static int decodeIntFromHex(String intAsString) {
21: if ((intAsString.charAt(1) == 'x')
22: || (intAsString.charAt(1) == 'X')) {
23: return Integer.parseInt(intAsString.substring(2), 16);
24: }
25:
26: return Integer.parseInt(intAsString, 16);
27: }
28: }
|