now token ring algorithm looks fully compatible with the java code.
You can:
signin/signout
add/edit/delete
using token ring algorithm with the java code hossain gave