Prove that the function $f: \mathbb{Z} \rightarrow \mathbb{N} \cup \{{0}\}$ defined by
$$f(x)= \left\{ \begin{array}{lcc} 2x & x \geq 0 \\ \\ -2x-1& x<0 \\ \\ \end{array} \right.$$ is bijective.
I don't have any familiarity with piecewise functions when dealing with bijective proofs yet. I'm assuming I have to show the bijection for two separate cases? Like for injective assume $f(x)=f(y)$ for some and arrive at $x=y$ with both cases? Would it be possible to find an inverse which would imply its bijective also?