Here you can find the source of colorToHex(int integer)
Parameter | Description |
---|---|
integer | a parameter |
private static String colorToHex(int integer)
//package com.java2s; public class Main { /**// ww w .jav a 2 s . c o m * Convert an integer representing a color scale to 2 hex digits. * * @param integer * @return A string of exactly 2 hexadecimal digits. */ private static String colorToHex(int integer) { if (integer > 255) { throw new IllegalArgumentException( "Color value cannot be great than 255"); } if (integer > 15) { return Integer.toHexString(integer); } return "0" + Integer.toHexString(integer); } }