Dijkstra's Algorithm for Shortest-path in Java