Discuss / Java / 转16进制!!!

转16进制!!!

Topic source

王乔疯

#1 Created at ... [Delete] [Delete and Lock User]

import java.util.*;

public class Main {

    public static void main(String[] args) {

        String hex = toHex(12500);

        if (hex.equalsIgnoreCase("30D4")) {

            System.out.println("测试通过");

        } else {

            System.out.println("测试失败");

        }

    }

    static String toHex(int n) {

     String hex = Integer.toHexString(n);

     Integer.parseInt(hex, 16);

        return hex;

    }

}

小草爱恋

#2 Created at ... [Delete] [Delete and Lock User]

你这直接是作弊啊


  • 1

Reply