code: public static long convertToPrecedingCummulative(final long[] array) {
      long subtotal = 0;
      for (int i = 0; i < array.length; i++) {
        final long newSubtotal = subtotal + array[i];
        array[i] = subtotal;
        subtotal = newSubtotal;
      }
      return subtotal;
    }
docs: Convert the weights into totals of the weights preceding each item
  @param array of weights
  @return total weight