0

I built a table in Java. Now I want to close the right side of the table using vertical bars. I want it to loke like this:

+------------------------------+--------+--------+--------+--------+-----------+----------+
|             Date             |  Open  |  High  |  Low   |  Close | Adj_Close |  Volume  |
+------------------------------+--------+--------+--------+--------+-----------+----------+
| Tue Dec 31 00:00:00 CET 2019 | 1513.8 | 1523.4 | 1513.8 | 1519.5 |  1519.5   | 301    > | < those
| Thu Jan 02 00:00:00 CET 2020 | 1518.1 | 1528.7 | 1518.0 | 1524.5 |  1524.5   | 214250 > | <
| Fri Jan 03 00:00:00 CET 2020 | 1530.1 | 1552.7 | 1530.1 | 1549.2 |  1549.2   | 10     > | <
| Sun Jan 05 00:00:00 CET 2020 | 1562.7 | 1590.9 | 1562.3 | 1571.6 |  1571.6   | 1644577> | <

How can I tell Java to set vertical bars to form a straight line?

I would assume to count the characters of the value in Volume and add the difference to a constant lenght in form of blank spaces, but how can I realize that?

Screenshot

(This is what it looks like now)

This is the code that creates the lines:

return "| "+ this.Date + " | " + /*...*/ this.Adj_Close + "   | " + this.Volume;
notescrew
  • 3,072
  • 4
  • 21
  • 36
wolfus
  • 31
  • 6

0 Answers0