return text;
}
+ /**
+ * Justify a text into width-sized (at the maximum) lines and return all the
+ * lines concatenated into a single '\\n'-separated line of text.
+ *
+ * @param text
+ * the {@link String} to justify
+ * @param width
+ * the maximum size of the resulting lines
+ *
+ * @return a list of justified text lines concatenated into a single
+ * '\\n'-separated line of text
+ */
+ static public String justifyTexts(String text, int width) {
+ StringBuilder builder = new StringBuilder();
+ for (String line : justifyText(text, width, null)) {
+ if (builder.length() > 0) {
+ builder.append('\n');
+ }
+ builder.append(line);
+ }
+
+ return builder.toString();
+ }
+
/**
* Justify a text into width-sized (at the maximum) lines.
*
* the input data
*
* @return the hash
+ *
+ * @deprecated please use {@link HashUtils}
*/
+ @Deprecated
static public String getMd5Hash(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
* <p>
* Examples:
* <ul>
- * <li><tt>8 765</tt> becomes "8k"</li>
- * <li><tt>998 765</tt> becomes "998k"</li>
- * <li><tt>12 987 364</tt> becomes "12M"</li>
- * <li><tt>5 534 333 221</tt> becomes "5G"</li>
+ * <li><tt>8 765</tt> becomes "8 k"</li>
+ * <li><tt>998 765</tt> becomes "998 k"</li>
+ * <li><tt>12 987 364</tt> becomes "12 M"</li>
+ * <li><tt>5 534 333 221</tt> becomes "5 G"</li>
* </ul>
*
* @param value
* <p>
* Examples (assuming decimalPositions = 1):
* <ul>
- * <li><tt>8 765</tt> becomes "8.7k"</li>
- * <li><tt>998 765</tt> becomes "998.7k"</li>
- * <li><tt>12 987 364</tt> becomes "12.9M"</li>
- * <li><tt>5 534 333 221</tt> becomes "5.5G"</li>
+ * <li><tt>8 765</tt> becomes "8.7 k"</li>
+ * <li><tt>998 765</tt> becomes "998.7 k"</li>
+ * <li><tt>12 987 364</tt> becomes "12.9 M"</li>
+ * <li><tt>5 534 333 221</tt> becomes "5.5 G"</li>
* </ul>
*
* @param value
*/
public static String formatNumber(long value, int decimalPositions) {
long userValue = value;
- String suffix = "";
+ String suffix = " ";
long mult = 1;
if (value >= 1000000000l) {