English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
parseInt()
Because the second parameter is the base, so use the second parameter as16method. TheparseInt()
The method has the following two forms.
static int parseInt(String s) static int parseInt(String s, int radix)
To convert a hexadecimal string to decimal, please use the second syntax and add the base as16Because the hexadecimal base is16.
Integer.parseInt("12", 16)
public class Demo { public static void main(String args[]) { //Convert to Decimal System.out.println(Integer.parseInt("444", 16)); } }
Output Result
1092