code: @SuppressWarnings("cast")
      public static int calcHash(char[] buffer, int start, int len) {
          int hash = (int) buffer[start];
          for (int i = 1; i < len; ++i) {
              hash = (hash * 31) + (int) buffer[start+i];
          }
          return hash;
      }
docs: Implementation of a hashing method for variable length
  Strings. Most of the time intention is that this calculation
  is done by caller during parsing, not here; however, sometimes
  it needs to be done for parsed "String" too.
  
  @param len Length of String; has to be at least 1 (caller guarantees
  this pre-condition)