Java Hex Calculate toHex(int v)

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

Description

to Hex

License

Apache License

Declaration

static String toHex(int v) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    static String toHex(int v) {
        v = Math.min(Math.max(v, 0), 255);
        return String.valueOf("0123456789abcdef".charAt(((v - v % 16) / 16))) + //$NON-NLS-1$
                String.valueOf("0123456789abcdef".charAt(v % 16)); //$NON-NLS-1$
    }//w  ww . j a  v  a 2s  . c o m
}

Related

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