java sample 1 for Algebra