Here you can find the source of rgbToText(int red, int green, int blue)
public static String rgbToText(int red, int green, int blue)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010-2015 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w . j av a2 s . com*/ * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ public class Main { /** * Converts a color's RGB presentation to a textual hexadecimal representation. * <p> * Example: r = 255, g = 0, b = 0 --> "#ff0000" * <p> * Note: the hexadecimal representation is lowercase * * @return hexadecimal representation of RGB in lowercase. * @since 4.0-M7 */ public static String rgbToText(int red, int green, int blue) { return String.format("#%02x%02x%02x", red, green, blue); } }