——————————————————————————————————————————————————————————————————————————
分析:
使用静态方法:Long.toHexString();
——————————————————————————————————————————————————————————————————————————
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); while(cin.hasNext()) { long num = cin.nextLong(); String hex_num = Long.toHexString(num); hex_num = hex_num.toUpperCase(); System.out.println(hex_num); } cin.close(); } }
蓝桥杯软件大赛练习系统——基础练习 十进制转十六进制,布布扣,bubuko.com
原文地址:http://blog.csdn.net/kuaisuzhuceh/article/details/26212769