public static void getTopNZ(float[] array, int[] counts,
			ArrayList<Integer> rankList, ArrayList<Float> rankProbs, int i, int threshold) {
		// clear
		rankList.clear();
		rankProbs.clear();
		//
		int index = 0;
		float max = Float.MIN_VALUE;
		for (int m = 0; m < i && m < array.length; m++) {
			boolean flag = false;
			max = Float.MIN_VALUE;
			for (int no = 0; no < array.length; no++) {
				if(counts[no] >= threshold) {
					if (array[no] >= max && !rankList.contains(no)) {
						index = no;
						max = array[no];
						flag = true;
					}
				}
			}
			if(flag) { // found value
				rankList.add(index);
//				rankProbs.add(array[index]);
				rankProbs.add(counts[index] + 0.0f);
			}
			//System.out.println(m + "\t" + index);
		}
	}