?
前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。
用例: Long.toHexString(number) ?其中 ?number ?是一個long類型參數。
?
描述:
java.lang.Integer.toHexString()?方法返回為無符號整數基數為16的整數參數的字符串表示形式。以下字符作為十六進制數字:0123456789ABCDEF。
聲明:
以下是java.lang.Integer.toHexString()方法的聲明
public static String toHexString(int i)
static String toHexString(int i)
?
?
參數
-
i?-- 這是一個整數被轉換為一個字符串.
返回值 :
此方法返回的字符串表示的無符號整數參數所表示的值以十六進制(基數為16).
實例:
下面的例子顯示使用的java.lang.Integer.toHexString()方法.
package com.yiibai;import java.lang.*;public class IntegerDemo {public static void main(String[] args) {int i = 170;System.out.println("Number = " + i);/* returns the string representation of the unsigned integer valuerepresented by the argument in hexadecimal (base 16) */System.out.println("Hex = " + Integer.toHexString(i));}
}
讓我們來編譯和運行上面的程序,這將產生以下結果:
Number = 170
Hex = aa
?
?
?