public CellularFilter() { results = new Point[3]; for (int j = 0; j < results.length; j++) results[j] = new Point(); if (probabilities == null) { probabilities = new byte[8192]; float factorial = 1; float total = 0; float mean = 2.5f; for (int i = 0; i < 10; i++) { if (i > 1) factorial *= i; float probability = (float) Math.pow(mean, i) * (float) Math.exp(-mean) / factorial; int start = (int) (total * 8192); total += probability; int end = (int) (total * 8192); for (int j = start; j < end; j++) probabilities[j] = (byte) i; } } }