Java can't compile in the browser - read the steps and type the code into the editor. Run it on your own machine when you're ready (any IDE with a JDK works).
Reference
int[] arr = [1, 2, 3];
int total = 0;
for(int i = 0; i < arr.length; i++){
total += arr[i];
}
System.out.println(total);