shortest route program in java