if X is negative take the absolute value of X .
X = Math . abs ( X ) ; if ( has [ X ] [ 1 ] == true ) { return true ; } return false ; } static void insert ( int a [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] >= 0 ) { has [ a [ i ] ] [ 0 ] = true ; } else { has [ Math . abs ( a [ i ] ) ] [ 1 ] = true ; } } }