considering present character as the second digit of two digits no we check if the value of this key is marked in hash or not If marked then we a have a number divisible by 8
if ( visited [ mp . get ( str . charAt ( i ) - '0' ) ] ) { System . out . print ( " Yes " ) ; break ; } visited [ str . charAt ( i ) - '0' ] = true ; }