private static boolean containsEmbeddedWhitespace(String value) {
      int state = 0;
      for (int i = 0, len = value.length(); i < len; i++)
        switch (value.charAt(i)) {
        case ' ':
        case '\t':
        case '\r':
        case '\n':
          if (state == 1)
            state = 2;
          break;
        default:
          if (state == 2)
            return true;
          if (state == 0)
            state = 1;
          break;
        }
      return false;
    }