Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ArrayOps
- {
- /**
- This method adds up the integer values in an array,
- with the integer sum returned at the end of the method.
- @param values, an array of integers, may be positive or negative
- @ return, the sum of the integers
- */
- public static int sumArray(int values[])
- {
- int count = 0;
- for(int a : values)
- {
- count+=a;
- }
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement