Calculating the maximum of first ancestor of u and v
maxWei = Math . max ( maxWei , Math . max ( maxWeight [ v ] [ 0 ] , maxWeight [ u ] [ 0 ] ) ) ; System . out . print ( minWei + " ▁ " + maxWei + "NEW_LINE"); } }