I've been digging in hash table source code. And found how hashing occurs:

```
int index = (hash & 0x7FFFFFFF) % tab.length;
```

I don't understand why bitwise AND used here?

if we turn 0x7FFFFFFF into binary we get = 111 1111 1111 1111 1111 1111 1111 1111

As I know bitwise AND will give **1** if first digit and second = **1**
So if we get some object hashcode for example `2314539`

turn it into binary and do & operation we actually get the same digit:

2314539 = 10 0011 0101 0001 0010 1011

```
10 0011 0101 0001 0010 1011
&
11 1111 1111 1111 1111 1111
=
10 0011 0101 0001 0010 1011
```

10 0011 0101 0001 0010 1011 = 2314539

As you can see this operation doesn't make any changes. So what's a point here?

`hash`

to positive values (it clears the sign bit).