public Key createKey(String method,String key){
  KeyField keyImpl=new KeyField();
  try {
    keyImpl.setMethod(method);
    keyImpl.setKey(key);
  }
 catch (  SdpException s) {
    s.printStackTrace();
    return null;
  }
  return keyImpl;
}

public Key createKey ( String method , String key ) { KeyField keyImpl = new KeyField ( ) ; try { keyImpl . setMethod ( method ) ; keyImpl . setKey ( key ) ; } catch ( SdpException s ) { s . printStackTrace ( ) ; return null ; } return keyImpl ; }
returns key object with the specified value .
