code: public static String chop(String source, int length) {
      try {
        return source.substring(0, length);
      } catch (StringIndexOutOfBoundsException e) {
        return source;
      } catch (NullPointerException e) {
        return null;
      }
    }
docs: Chops a string off after a certain number of characters. If the string is shorter than the
  length, then the string is returned untouched. nulls are returned as null.
  
  @param source
  @param length