code: private static int calculateWidthOfJustifiedSpaceInPixels(final Font font,
  			final String s, final int leftWidth) {
  		int space = 0; // hold total space; hold space width in pixel
  		int curpos = 0; // current string position
  
  		// count total space
  		while (curpos < s.length()) {
  			if (s.charAt(curpos++) == ' ') {
  				space++;
  			}
  		}
  
  		if (space > 0) {
  			// width left plus with total space
  			// space width (in pixel) = width left / total space
  			space = (leftWidth + (font.getWidth(" ") * space)) / space;
  		}
  		return space;
  	}
docs: Calculates and returns the width of a single justified space for the
  given {@link String}, in pixels.
  
  @param font The font to draw with
  @param s
  The given non-null {@link String} to use to calculate the
  width of a space for.
  @param leftWidth
  The integer specifying the left width buffer to use to
  calculate how much space a space should take up in
  justification.
  @return The width of a single justified space for the given
  {@link String}, in pixels.