Justifying a string followed by a number
You are vastly overcomplicating the solution.  The Scanner is perfectly capable of reading a string and an integer separately.  Then, it is a simple matter of calling System.out.printf() with the appropriate width specifications:


%-15s for a string, left-justified, with trailing spaces
%03d for an integer, zero-padded


Also, Scanner is AutoCloseable, so you should use a try-with-resources block instead of calling .close() on it manually.

import java.util.Scanner;

public class IOFormatting {
    public static void main(String[] args) {
        try (Scanner input = new Scanner(System.in)) {
            while (input.hasNext()) {
                System.out.printf("%-15s%03d%n", input.next(), input.nextInt());
            }
        }
    }
}


If you really wanted to do the formatting the hard way by inserting spaces and zeroes, I suggest editing each line using StringBuilder.insert() — your ArrayList&lt;Character&gt; is a rather unnatural way to edit a string.