Here you can find the source of toHex(int value, int bits)
Parameter | Description |
---|---|
value | pixel value |
bits | a parameter |
public static String toHex(int value, int bits)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . j a v a 2s.co m * Conversion pixel to HEX value * @param value pixel value * @param bits * @return HEX presentation of pixel */ public static String toHex(int value, int bits) { String hex = Integer.toHexString(value); int padLen = 4 - hex.length(); if (bits == 0) { padLen = 2 - hex.length(); } for (int i = 0; i < padLen; i++) { hex = "0" + hex; } hex = "0x" + hex; return hex; } }