adding java algorithms