Java Hex Calculate toHexChar(int i)

Here you can find the source of toHexChar(int i)

Description

convert a integer into a hexadecimal character

License

Open Source License

Parameter

Parameter Description
i integer

Return

hex char

Declaration

public static char toHexChar(int i) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from w w w  . j a v a 2s .  c o  m*/
     * convert a integer into a hexadecimal character
     *
     * @param i integer
     * @return hex char
     */
    public static char toHexChar(int i) {
        if ((0 <= i) && (i <= 9)) {
            return (char) ('0' + i);
        } else {
            return (char) ('a' + (i - 10));
        }
    }
}

Related

  1. toHexChar(char ch, StringBuffer sb)
  2. toHexChar(int b)
  3. toHexChar(int digit)
  4. toHexChar(int digitValue)
  5. toHexChar(int digitValue)
  6. toHexChar(int i)
  7. toHexChar(int i)
  8. toHexChar(int nibble)
  9. toHexChar(int paramInt)