Advertisement
advictoriam

Untitled

Jan 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class ArrayOps
  2. {
  3.    /**
  4.       This method adds up the integer values in an array,
  5.       with the integer sum returned at the end of the method.
  6.       @param values, an array of integers, may be positive or negative
  7.       @ return, the sum of the integers
  8.    */
  9.    public static int sumArray(int values[])
  10.    {
  11.       int count = 0;
  12.       for(int a : values)
  13.       {
  14.          count+=a;
  15.          
  16.       }
  17.       return count;
  18.    }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement