/ Published in: Java

Generic method for printing a list to the console based on the number of characters per line.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// initialize a mutable string // now insert a line break at every point necessary // the break comes after the numberOfCharsPerLine int pos = numberOfCharsPerLine; while (pos < pretty.length()) { pretty.insert(pos+1, '\n'); pos += numberOfCharsPerLine; } return pretty.toString(); }
Comments
