Integer.parseInt(string,2)
时间: 2024-06-01 19:11:35 浏览: 129
convert string to integer
The method "Integer.parseInt(string,2)" is used to convert a binary string representation of an integer to its decimal equivalent.
The first parameter "string" is the binary string that needs to be converted. The second parameter "2" indicates that the string is a binary representation.
For example, if we have a binary string "1010", we can use the method as follows:
int decimalValue = Integer.parseInt("1010", 2);
The variable "decimalValue" will now have the value 10, which is the decimal equivalent of the binary string "1010".
阅读全文