Some algorithms  implementation for java