Another aproach to solve this problem with the help of streams:
int[] A = { 1, 2, 3, 4 }; double arrASum = IntStream.of(A).map(s -> s * s).sum();