Here you can find the source of convertRGBDecToHex(String decimal)
Parameter | Description |
---|---|
decimal | the decimal |
public static String convertRGBDecToHex(String decimal)
//package com.java2s; /*/*from w w w. ja v a2s . co m*/ * M2M ServiceFOTA ONM version 1.0 * * Copyright ? 2014 kt corp. All rights reserved. * * This is a proprietary software of kt corp, and you may not use this file except in * compliance with license agreement with kt corp. Any redistribution or use of this * software, with or without modification shall be strictly prohibited without prior written * approval of kt corp, and the copyright notice above does not evidence any actual or * intended publication of such software. */ import java.util.Formatter; public class Main { /** * Convert rgb dec to hex. * * @param decimal the decimal * * @return the string */ public static String convertRGBDecToHex(String decimal) { String returnValue = null; Formatter formatter = null; formatter = new Formatter(); returnValue = "#" + formatter .format("%02x%02x%02x", Integer.parseInt(decimal.substring(0, 3)), Integer.parseInt(decimal.substring(3, 6)), Integer.parseInt(decimal.substring(6, 9))) .toString(); return returnValue; } }