Here you can find the source of normalizeForce(double[] data)
public static boolean normalizeForce(double[] data)
//package com.java2s; //License from project: Apache License public class Main { public static boolean normalizeForce(double[] data) { double sum = 0; for (double x : data) sum += x;//w w w . j a va 2 s .c o m if (sum == 0) { for (int i = 0; i < data.length; i++) data[i] = 1.0 / data.length; return false; } else { for (int i = 0; i < data.length; i++) data[i] /= sum; return true; } } }