Q: Is it possible to implement tostring string method and printf? I'm a beginner to Java.
My program is given an output in tabular form, and it returns from a method called **calculateShoes. I'm just wondering if it is possible to do printf while return is on there. I tried putting a System.out.printf (after the return statement) to use the "|%3d|" for spacing but it's not working.
@Override
    public String toString()
    {
      return "|     " + this.numberOfShoes + "  |     " + this.sumOfShoesInputted 
      + "    |   " + this.lowestNumberOfShoes + " to " + this.highestNumberOfShoes + "|";
    }
I realize that this looks messy, and the data outputted moves the "|". I would like to have it fixed and not resized all the time. I hope there's a cleaner way to do this. 
**Sorry I had the wrong boolean method >_<.

A: You can try using String.format():
return String.format("|%3d|", some_variable);

This method works similarly to System.out.printf()
