Tweaking the output

I've got this program that prints an integer, then in the next column it shows the square, then in the next column it shows the cube. I want it to

look like this:

[ code]

ValueSquareCube

11 1

24 8

39 27

41664

[/code]

You get the idea:

But for some reason the numbers under the Cube column are not looking right. They're looking ragged like this:

ValueSquareCube

111

248

3927

416 64

525 125

Why is it printing like that? How can I fix it? It doesn't appear Java has a setw( ) manipulator like C++ does.

[618 byte] By [357maga] at [2007-11-27 9:49:44]
# 1
Well you may not be able to get what I mean cuz of the way the formatting is on this board. But the way the numbers are printing under the Cube column is not the same as the nice way they look under the Square column.
357maga at 2007-7-13 0:18:20 > top of Java-index,Java Essentials,New To Java...
# 2
consider looking in on String.format(String, Object....). Look here: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object...)
petes1234a at 2007-7-13 0:18:20 > top of Java-index,Java Essentials,New To Java...
# 3
Or you can use the printf method.
floundera at 2007-7-13 0:18:20 > top of Java-index,Java Essentials,New To Java...
# 4
> Or you can use the printf method.Yep. I think that it uses the same "format" as the String.format method does.
petes1234a at 2007-7-13 0:18:20 > top of Java-index,Java Essentials,New To Java...