битовые-операции

How does the ~ inversion operator work in java?

There is a code: for(int i = -2; i<2; i++) System.out.printf("Инверсия %d даст %d. \n", i, ~i ); At the exit: И ... actually (explain on one and zero) does this damn operator work? And why did the language developers make it work like this?