I have to write a code in Java that will take a String and put a certain number of characters on each line (the fixed width). I will also have to put extra spaces in to fill in any extra spots, like if four words only equal 23 characters and the line calls for 25, so I'd need to input two extra spaces. This is for a beginning class, so it just needs to be as basic as possible. So far, what I have is:
public static void print (String[] theWords, int width) {
int start = 0, end = 0, lineCounter = 0;
int[] gaps;
Where do I go from here?