Q:

Displaying a symbol after a certain number of spaces in java

My output looks like this
  000(05.00)      *|
  001(25.00)      ******|
  002(36.00)      **********|

Ideally I would like my output to be this....
  000(05.00)      *         |
  001(25.00)      ******    |
  002(36.00)      **********|

I have this as my variable...
  private static String MAX_REP = "|";

What can I do to MAX_REP to print that bar for every line at that same spot?

A:

Firstly, record each line as a String.
Then calculate the String's length.  Add N-k spaces before MAX_REP when you print, where N is the position you want and k is the length of the given line.

