java進位轉碼

來源:互聯網
上載者:User

標籤:eof   十六進位   ext   意思   blog   binary   十進位   string   二進位   

定義十進位的數直接寫,定義8進位的數以0開頭,定義二進位的數以0b開頭,定義十六進位的數以0x開頭
需要將十進位的數以二進位的數表示出來可以參照下例:
int a = 10;System.out.println(Integer.toBinaryString(a));
轉換成八進位把Binary換成Octal
轉換成十六進位把Binary換成Hex
解釋:Binary是二進位的意思,Octal是八進位的意思,Hex是十六進位的意思。

 
十進位轉成十六進位: 
Integer.toHexString(int i)
十進位轉成八進位
Integer.toOctalString(int i)
十進位轉成二進位
Integer.toBinaryString(int i)
十六進位轉成十進位
Integer.valueOf("FFFF",16).toString()
八進位轉成十進位
Integer.valueOf("876",8).toString()
二進位轉十進位
Integer.valueOf("0101",2).toString()

 

java進位轉碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.