Java Hex Calculate toHexString(int number, int digit)

Here you can find the source of toHexString(int number, int digit)

Description

to Hex String

License

Open Source License

Declaration

private static String toHexString(int number, int digit) 

Method Source Code

//package com.java2s;
//The MIT License

public class Main {
    private static final String HEX_LETTER = "0123456789ABCDEF";

    private static String toHexString(int number, int digit) {
        String result = "";
        while (digit-- > 0) {
            int n = number % 16;
            number /= 16;// w  w  w.j  av a  2  s.  c o  m
            result = HEX_LETTER.substring(n, n + 1) + result;
        }
        return result;
    }
}

Related

  1. toHexString(int i)
  2. toHexString(int i, int digits)
  3. toHexString(int input)
  4. toHexString(int iValue)
  5. toHexString(int n)
  6. toHexString(int r, int g, int b, int a)
  7. toHexString(int val)
  8. toHexString(int val, int minLength)
  9. toHexString(int value, int len)