Java tutorial
//package com.java2s; public class Main { private static String pickGradient(int length) { String[] colors = { "ffcc00", "ff9900", "ff6600", "ff3300", "fd0000" }; String out = new String(); if (length >= 1) out += colors[0]; for (int i = 1; i < length; i++) { out += "," + colors[i]; } return out; } }