DFS AND BFS search algorithm implementation in java.