If curr_power - power already exists in map then we have found a subarray with target power .
if ( map . containsKey ( curr_power - power ) ) { System . out . println ( " Substring ▁ from ▁ index ▁ " + ( map . get ( curr_power - power ) + 1 ) + " ▁ to ▁ " + i + " ▁ has ▁ power ▁ " + power ) ; return ; } map . put ( curr_power , i ) ; }