Printing lines in a format in java -


so project implement paging, recalling paging unlike swapping allows memory of process broken in frames. problem structure have print this. char 'a4' , 'e4' such given these examples processed 280 frames. char stored in string[] memory. have print these memory stated 2 string char of alp , number. needs when done:

        04        09        14        19        24        29 --------++--------||--------++--------||--------++--------|| a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7         31        33        35        37        39        41 --------++--------||--------++--------||--------++--------|| a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7 

so top increments of location of string array showing 5th 1 starting @ 00. have -------++------ looks guess. , last line of string[] memory , in array.

this have far:

    public static void printpmem(string[]memory, int colm, int increment){     //true memory     //this prints stuff in memory     int call = 0;      printloc(0);     printstuff();         (int i=0; < max_frames; i++)         {                 system.out.print(memory[i]);                 colm++;                 if (colm == 120)                 {                        system.out.print("\n");                     colm = 0;                     call++;                 }         } }     public static void printstuff(){         system.out.print("\n");         system.out.print("--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||\n");     }     public static void printloc(int loc){          for(int showloc = 0; showloc<max_frames; showloc++)         {              increment++;             loc++;         if (increment == 4)         {             system.out.printf("     %02d      ", loc);             increment = 0;         }         if (showloc == 120){             system.out.print("\n");         }         if (showloc == 240){             system.out.print("\n");         }         }     } 

this output cant right @ all. please help!

     04           08           12           16           20           24           28           32           36           40           44           48           52           56           60           64           68           72           76           80           84           88           92           96           100           104           108           112           116           120            124           128           132           136           140           144           148           152           156           160           164           168           172           176           180           184           188           192           196           200           204           208           212           216           220           224           228           232           236           240            244           248           252           256           260           264           268           272           276           280       --------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------||--------++--------|| r7l9f5b2r6j9c9a6f3e5f6a1a6d4c9g6l6j9i8h5a1a1k2u4f6a6r7a1g6b2c3b5h3r7k1r6c3e5g6h5g6n2c3n2l6l6o2a6p3h5e7g6g6x3c3e5t8f5h5u4j9b2p3f6a1k1k1u4r2z3l6t8g6f5e5e7o2x3l6a6b5m1m1o2j9h5z3t8g6o2t8b5f3a1b2o2a1i8f5b5g6r2c3c9e5b2t8r6g6k2b2t8f5j9r6n2n2r7u4u4 l6i8c3f5x3f5p3m1n2f5a1h5e7d4h7v6j9a1a1e5a1f6r7y5l6c9c2h7w8c2u4m1w8c3c3c2f5l6b5h5v6b5t8l9h3e7o2g6i8d4b2i8t8a6l9k1d4c9k1h3h7h3r7l9t8c3f5c9r7c9f5k1b5c9l6r7c2f3j9g6g6h7h3a6x3a6k2g6m1i8a1c3k1b2x3k2c2r7d4h3e5o2l9t8h3z3r7g6e7r7l6m1g6h5r2e7x4x3i8y5 

its little off width of line should 120 long. 60 elements. putting on website makes ugly.

so there way can set line var go line fill in more? im not sure how this.

how can go printing in order show? starting with: location of array incrmenets show of 5 these stupid dash things -------++++ string array of elements

you can't go back line once has been printed. can use same size field of numbers line properly. simplest replace %02d %04d (and adjusting spaces necessary); handle up-to-4 digit numbers.

if need numbers @ least 2 digits (w/ leading 0 if necessary), no more if not needed, can use %4d if value > 99, , %02d (with 2 leading spaces) otherwise.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -