1.String转int有两种方式
(1)Integer.parseInt(str)
(2)Integer.valueOf(str).intValue()
在 Java 中:
如果字符串超过 3333 位,不能转化为 二进制Integer
如果字符串超过 6565 位,不能转化为 Long
如果字符串超过 500000001500000001 位,不能转化为 二进制BigInteger
作者:LeetCode-Solution
链接:https://leetcode-cn.com/problems/add-binary/solution/er-jin-zhi-qiu-he-by-leetcode-solution/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
2.int转String有三种方式
(1)num + “”
(2)String.valueOf(num)
(3)Integer.toString(num)