common Java Function