byte counter = 0;

for (byte i = 0; i < 5; i++) {
    counter += i;
}
        
System.out.println(counter);