Java Array Sum sum(float[] a, int off, int length)

Here you can find the source of sum(float[] a, int off, int length)

Description

sum

License

Open Source License

Declaration

public static float sum(float[] a, int off, int length) 

Method Source Code

//package com.java2s;
/*//w w w .  j a v a 2 s.c  om
 *  Util.java
 *  (FScape)
 *
 *  Copyright (c) 2001-2015 Hanns Holger Rutz. All rights reserved.
 *
 *  This software is published under the GNU General Public License v3+
 *
 *
 *   For further information, please contact Hanns Holger Rutz at
 *   contact@sciss.de
 *
 *
 *  Changelog:
 *      17-Jun-07   extended
 */

public class Main {
    public static float sum(float[] a, int off, int length) {
        double d = 0.0;
        final int stop = off + length;
        while (off < stop)
            d += a[off++];
        return (float) d;
    }
}

Related

  1. sum(final int base, final int[] ints)
  2. sum(final int[] terms, final int start, final int len)
  3. sum(final int[] values)
  4. sum(final int[] values, final int... indice)
  5. sum(final long... values)
  6. sum(float[] array)
  7. sum(float[] distribution)
  8. sum(float[] items, int offset, int length)
  9. sum(float[] vector)