public String extract_package(String fullname){
  return fullname.replaceFirst("[.][^.]*$","");
}

public String extract_package ( String fullname ) { return fullname . replaceFirst ( "[.][^.]*$" , "" ) ; }
return the package name from a fully specified classname
