how to loop through an array

Java
let numbers = [1,2,3,4,5];
let numbersLength = numbers.length;
for ( let i = 0; i < numbersLength; i++) {
    console.log (numbers[i]);
}String[] myStringArray = {"Hello", "World"};
for (String s : myStringArray)
{
    // Do something
}/* ES6 */
const cities = ["Chicago", "New York", "Los Angeles"];
cities.map(city => {
	console.log(city)
})
int[] numbers = {1,2,3,4,5};
for (int i = 0; i < numbers.length; i++) {
	System.out.println(i);
}array = [ 1, 2, 3, 4, 5, 6 ]; 
for (index = 0; index < array.length; index++) { 
    console.log(array[index]); 
} var txt = "";
var numbers = [45, 4, 9, 16, 25];

numbers.forEach(function(value, index, array) {
  txt = txt + value + "<br>";
});

Source

Also in Java: