Dijkstra Algorithm Implementation in Java