You can tell the parseInt() method what base number system is used by the String that is being parsed.
String hex = "01001101";
int n = Integer.parseInt(hex, 2);
written by objects
\\ tags: binary, conversion, convert, int, integer, parse
public static String zeroPad(int value, int width) {
return String.format("%0"+width+"d", value);
}
written by objects
\\ tags: format, int, pad, string
You can tell the parseInt() method what base number system is used by the String that is being parsed.
String hex = "a9b0";
int n = Integer.parseInt(hex, 16);
written by objects
\\ tags: hex, int, parse
Recent Comments