Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static ArrayList<Double> normalizeVector(ArrayList<Double> vector) { ArrayList<Double> returnValue = new ArrayList<>(); if (vector.size() > 0) { Double first = vector.get(0); for (Double d : vector) { returnValue.add(d - first); } } return returnValue; } }