Java math project