When you work on a program or create a system that requires you to pad a String using spaces, all you need to do is to consider the width of a String. If the width is less than the target length, you can pad the String with spaces to guarantee the length of that String. Java Left Pad String with spaces is important specially when interfacing with older systems like a mainframe, where deciding which part of data is defined by number of characters, instead of more sophisticated way like XML or JSON format.