Java Hex Format formatHex(double theG)

Here you can find the source of formatHex(double theG)

Description

format Hex

License

Apache License

Parameter

Parameter Description
theG a parameter

Declaration

private static String formatHex(double theG) 

Method Source Code

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

public class Main {
    /**//from w  w w.  j  a v a  2s .com
     * @param theG
     * @return
     */
    private static String formatHex(double theG) {
        int value = (int) (theG * 256);
        String retVal = Integer.toHexString(value);

        int len = retVal.length();
        switch (len) {
        case 0:
            retVal = "00";
            break;
        case 1:
            retVal = "0" + retVal;
            break;
        case 2:
            break;
        default:
            retVal = "FF";
        }

        return retVal;
    }
}

Related

  1. formatBytes2HexString(byte[] bytes, int offset, int length)
  2. formatByteToPaddedHex(int i, int l)
  3. formatColorInt2HexString(int c)
  4. formatGuidToDashedNotation(String hexValue)
  5. formatHEX(byte[] btValue, int iOffset, int iLength)
  6. formatHex(int value, int width)
  7. formatHex(Integer input)
  8. formatHexBytes(byte[] raw)
  9. formatHexInt(final StringBuilder dst, final int p, int w)