This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
|
package sequential;
|
|
|
|
// @ThreadSafe
|
|
public class SequentialSum {
|
|
|
|
private SequentialSum() {
|
|
// Cannot be instantiated
|
|
}
|
|
|
|
public static long sum(int nums[]) {
|
|
long result = 0;
|
|
for (int i = 0; i < nums.length; i++) {
|
|
result += nums[i];
|
|
}
|
|
return result;
|
|
}
|
|
}
|