Integer的toString()


1、Integer的toString() 有靜態和非靜態方法,還有toHexString  以及 toBinaryString、toUnsignedString

2、Integer還繼承了Number類,包括方法:intValue、longValue、floatValue、doubleValue、byteValue、shortValue

3、Integer.toString(int i); 就是將i轉為string

4、Integer.toString(int par1,int par2),par1表示要轉成字符串的數字,par2表示要轉成的進制表示,如:

Integer.toString(100,2),表示把100轉成2進制表示的字符串,

Integer.toString(100,10),表示把100轉成10進制表示的字符串,

Integer.toString(100,16),表示把100轉成16進制表示的字符串,

Integer.toString(100,36),表示把100轉成36進制表示的字符串,即100到36之間的數字表示為a到z的表示。  

===========================================

實際應用:牛客網判斷子串的一道題 https://ac.nowcoder.com/acm/problem/13253?&headNav=acm


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM