Java Hex Calculate toHex(int value)

Here you can find the source of toHex(int value)

Description

Returns the hexidecimal character representation for an integer.

License

Open Source License

Parameter

Parameter Description
value an integer

Return

the hexidecimal representation

Declaration

private static char toHex(int value) 

Method Source Code

//package com.java2s;
// are made available under the terms of the Eclipse Public License v1.0

public class Main {
    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
            'E', 'F' };

    /**//  ww w. j av a 2  s  .co m
     * Returns the hexidecimal character representation for an integer.
     * 
     * @param value
     *            an integer
     * @return the hexidecimal representation
     */
    private static char toHex(int value) {
        return HEX_DIGITS[(value & 0xF)];
    }
}

Related

  1. toHex(int r, int g, int b)
  2. toHex(int r, int g, int b)
  3. toHex(int v)
  4. toHex(int val)
  5. toHex(int val)
  6. toHEX(int value)
  7. toHex(int value)
  8. toHex(int value, int bits)
  9. toHex(int value, int length)