new alg fro java