Here you can find the source of distanceToColor(final int distance)
public static int distanceToColor(final int distance)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { /**//from w w w. j a v a2 s . co m * {@value} */ public static final int INTENSITY_MAX = 255; public static int distanceToColor(final int distance) { return new Color(INTENSITY_MAX - distance, INTENSITY_MAX - distance, INTENSITY_MAX - distance, INTENSITY_MAX).getRGB(); } }