Modified Main.java for Bellman ford