String inputString = "hello"; String outputString = StringUtils.leftPad(inputString, 10); System.out.println(outputString); // " hello"
int number = 42; String outputString = StringUtils.leftPad(Integer.toString(number), 5, "0"); System.out.println(outputString); // "00042"
String inputString = "world"; String outputString = StringUtils.leftPad(inputString, 8, "*"); System.out.println(outputString); // "***world"The StringUtils leftPad method is part of the Apache Commons Lang library, which provides a set of utility classes and methods for working with strings, arrays, and other common data types in Java.