Copyright doesn't do that at all.
However if someone else wrote their own code to do the same thing, it would not be protected, which is the point.
With respect to patents, inventions are about how you do something. Whether it is written in java or C is irrelevant. Similarly, for gadget patents, the material it is manufactured out of doesn't matter.
The question of rewriting a library in a different programming language has never been litigated, to my knowledge, so there's no precedent as to whether or not it would violate copyright. The customary practice is to assume that the code produced by anyone who has seen the original source code would qualify as a derivative work, and therefore to rely on a clean-room implementation, where one group inspects the source code and builds a spec that a second group uses to implement the replacement.
In the absence of legal precedent, the customary practice tends to be accorded legal preference, so it's reasonably likely that a court would rule that somebody who looks at a C implementation and produces a Java implementation without any intermediaries would constitute a derivative work and therefore be in violation of copyright if not properly authorized by the copyright owner.
[1] It's literally the first example given in the US law.
This is incorrect. Translations, in either natural or computer languages, qualify as derivative works under copyright law.