<prompt> Kuandika kazi katika Java kuzalisha bar maendeleo katika kwa loop iterating juu safu arr.  <response>: Heres an example function in Java to output a progress bar while iterating over an array using a for loop:public static void iterateWithProgressBarint arr int n arr.length; for int i 0; i n; i calculate progress percentage and print progress bar int progress intMath.roundi doublen 100; String progressBar .repeatprogress 10 .repeat10 - progress 10 ; print current value and progress bar System.out.printlnCurrent value: arri progressBar; This function takes an integer array arr as input and iterates over its elements using a for loop. At each iteration, it calculates the progress percentage as i n 100 and uses this percentage to construct a progress bar string using the String.repeat method.The progress bar string is printed along with the current value of the array element on each iteration. Note that the progress percentage is cast to an integer to round it to the nearest whole number before constructing the progress bar string. 