Java tutorial
//package com.java2s; import android.graphics.Color; public class Main { private static final double colorDistance(int color1, int color2) { int redDistance = Color.red(color1) - Color.red(color2); int greenDistance = Color.green(color1) - Color.green(color2); int blueDistance = Color.blue(color1) - Color.blue(color2); double distance = Math .sqrt(redDistance * redDistance + greenDistance * greenDistance + blueDistance * blueDistance); return distance / 256.; } }