code: public FormattedStringBuilder appendRightAligned(String s, int alignPosition) {
          int lineStart = _delegate.lastIndexOf(NL);
          int currentLength = _delegate.length();
          int rightPosition = alignPosition;
          if(lineStart != -1) {
              lineStart += NL.length();
              rightPosition = lineStart + alignPosition;
          }
          int fillPosition = rightPosition - s.length();
          if(fillPosition<currentLength) {
              throw new IllegalArgumentException("String \"" + s + "\" to right "
                  + "align is longer than the unfilled buffer space ["
                  + (rightPosition - currentLength) + "]");
          } else {
              fillBuffer(fillPosition, ' ');
          }
          return append(s);
      }
docs: Appends to the line the white spaces and then the string <tt>s</tt>
  so that the end of the string <tt>s</tt> is at the position
  <tt>alignPosition</tt>. If the string is longer than the free space
  in the buffer to the align position then an IllegalArgumentException
  is thrown.
  
  @param s String to append.
  @param alignPosition index of the last character of the string
  relative to the current line in the buffer.
  @return The updated instance of FormattedStringBuilder.
  @throws IllegalArgumentException if not enough space is allocated for
  the string.