Hey there I have a problem in java while printing... I have program in which I need to print some values which are in a loop. In every repetition of loop there is a new value formed now i want there should be when the loop end first value of first repetition should print then second and then so on... but in my case it is only printing the values of last execution[![enter image description here](https://i.stack.imgur.com/9cvEt.png)](https://i.stack.imgur.com/9cvEt.png)

Here i upload the picture of my output u can clearly see that only the values of last loop are printed
but i want in first row there should be the values of first loop in second row there should be the values of second loop and in third row there should be the values of third loop.

Here is my code

```
public class ManufactureClass {

        private static void outputtable() {

                    System.out.println(
                            "\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                    System.out.println("| No. of Order | No. of Units | Time Consumed by WA | Time Consumed by WB | Time Consumed by WH | Effective Units | Defective Units | Total Time Consumed By this Order | No. of Packages |");
                    System.out.println(
                            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                    for(int i=1;i<=total_orders;i++) {
                    long sum=Long.sum((time_consumed_by_Work_Station_H_in_thread_sleep_for_units_greater_than_30/1000), (time_consumed_by_Work_Station_B_in_thread_sleep/1000));
                    long sum1=Long.sum((time_consumed_by_Work_Station_A_in_integer/1000), sum);
                    total_time_consumed_by_order=Long.toString(sum1)+" seconds";
                    if(units_in_an_order<=30) {
                        System.out.println("|       "+loop_for_orders+"       |      "+number_of_units_in_order+"      | "+actual_time_by_Work_Station_A_in_seconds+" | "+actual_time_by_Work_Station_B_in_seconds+" | "+actual_time_by_Work_Station_H_in_seconds_for_units_less_than_30+" | "+effective_units+" | "+defective_units+" | "+total_time_consumed_by_order+" | "+number_of_packages_for_units_less_than_30+" | ");
                        System.out.println(
                                "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                        }else {

                        System.out.println("|      "+loop_for_orders+"       |      "+number_of_units_in_order+"      | "+actual_time_by_Work_Station_A_in_seconds+" | "+actual_time_by_Work_Station_B_in_seconds+" | "+actual_time_by_Work_Station_H_in_seconds_for_units_greater_than_30+" | "+effective_units+" | "+defective_units+" | "+total_time_consumed_by_order+" | "+number_of_packages_for_units_greater_than_30+" | ");
                        System.out.println(
                                "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
                        }
            }
        }
        public static void main(String[] args) throws InterruptedException {

            display_header();
            display_msg();

            for(loop_for_orders=1;loop_for_orders<=total_orders;loop_for_orders++) {
                Random rand = new Random(); 
                units_in_an_order = rand.nextInt(200);
                number_of_units_in_order=Integer.toString(units_in_an_order);
                int a=10;
                int b=100;
                defective_units =(float) (0.01*units_in_an_order);
                effective_units=units_in_an_order-defective_units;
            int zero1=0;
            int zero2=0;
            time_consumed_by_Work_Station_A = "" + units_in_an_order + zero1+zero2;
            time_consumed_by_Work_Station_A_in_integer = Long.parseLong(time_consumed_by_Work_Station_A);
            interval = units_in_an_order;
        Manufactured_units_by_work_station_A();
        permission();

        }
}

    outputtable();
}

```