Java tutorial
//package com.java2s; public class Main { public static double diffHsb(int hsb1[], final int hsb2[]) { if (hsb1 == null || hsb2 == null) { return 0.0; } if (hsb1.length < 3 || hsb2.length < 3) { return 0.0; } double h = Math.pow(hsb1[0] - hsb2[0], 2); double s = Math.pow(hsb1[1] - hsb2[1], 2); double b = Math.pow(hsb1[2] - hsb2[2], 2); return Math.sqrt(h + s + b); } }