code: public static byte[] textPadding(String text, Charset charset, int length, DBFAlignment alignment, byte paddingByte) {
  		byte response[] = new byte[length];
  		Arrays.fill(response, paddingByte);
  		byte[] stringBytes = text.getBytes(charset);
  
  		if (stringBytes.length > length) {
  			return textPadding(text.substring(0, text.length() - 1), charset, length, alignment, paddingByte);
  		}
  
  		int t_offset = 0;
  		switch (alignment) {
  		case RIGHT:
  			t_offset = length - stringBytes.length;
  			break;
  		case LEFT:
  		default:
  			t_offset = 0;
  			break;
  
  		}
  		System.arraycopy(stringBytes, 0, response, t_offset, stringBytes.length);
  
  		return response;
  	}
docs: pad a string and convert it to byte[] to write to a dbf file
  @param text The text to be padded
  @param charset Charset to use to encode the string
  @param length Size of the padded string
  @param alignment alignment to use to padd
  @param paddingByte the byte used to pad the string
  @return bytes to write to the dbf file