If you are using the Guava Lib, it supports methods such as Shorts.fromBytes(), and for integers Ints.fromBytes() that does this kind of operation for you.