* @param length
   * @param padchar
   * @param align
   * @param truncateP
   * @return String
   */
  public static String formatWithPadding(String input, int length, char padchar, Keyword align, boolean truncateP) {
    { int len = input.length();

      if (len == length) {
        return (input);
      }
      else if (len > length) {
        if (truncateP) {
          if (align == Stella.KWD_LEFT) {
            return (Native.string_subsequence(input, len - length, len));
          }
          else if (align == Stella.KWD_RIGHT) {
            return (Native.string_subsequence(input, 0, len - length));
          }
          else if (align == Stella.KWD_CENTER) {
            { int left = ((int)((len - length) / 2.0));

              return (Native.string_subsequence(input, left, left + length));
            }
          }
          else {
            { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

              stream000.nativeStream.print("`" + align + "' is not a valid case option");
              throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
            }
          }
        }
        else {
          return (input);
        }
      }
      else {
        if (align == Stella.KWD_LEFT) {
          return (input + Native.makeString(length - len, padchar));
        }
        else if (align == Stella.KWD_RIGHT) {
          return (Native.makeString(length - len, padchar) + input);
        }
        else if (align == Stella.KWD_CENTER) {
          { int left = ((int)((length - len) / 2.0));

            return (Native.makeString(left, padchar) + input + Native.makeString((length - len) - left, padchar));
          }
        }
        else {
          { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

            stream001.nativeStream.print("`" + align + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
          }
        }
      }
    }
  }