basic algorithms study with java