common algoritms c+java