Java Array Sum sum(byte... bytes)

Here you can find the source of sum(byte... bytes)

Description

sum

License

Open Source License

Declaration

public static byte sum(byte... bytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int sum(int... numbers) {
        int total = 0;
        for (int number : numbers) {
            total += number;//from   www. j  a v  a2 s.  co  m
        }
        return total;
    }

    public static double sum(double... numbers) {
        double total = 0.0;
        for (double number : numbers) {
            total += number;
        }
        return total;
    }

    public static long sum(long... numbers) {
        long total = 0;
        for (long number : numbers) {
            total += number;
        }
        return total;
    }

    public static short sum(short... numbers) {
        short total = 0;
        for (short number : numbers) {
            total += number;
        }
        return total;
    }

    public static byte sum(byte... bytes) {
        byte total = 0;
        for (byte b : bytes) {
            total += b;
        }
        return total;
    }
}

Related

  1. ArraySum(float[] a)
  2. arraySum(int[] intArray, short flag)
  3. getSum(int[] array)
  4. getSum(int[] array)
  5. sum( int[] a)
  6. sum(byte[] array)
  7. sum(byte[] array)
  8. sum(byte[] array, int offset, int size)
  9. sum(byte[] array, int offset, int size)