In order to convert from int to IP String I am using approach in Going from 127.0.0.1 to 2130706433, and back again
private static final byte BYTE_MASK = (byte)0xff;
protected byte[] unpack(int bytes) {
return new byte[] {
(byte)((bytes >>> 24) & BYTE_MASK),
(byte)((bytes >>> 16) & BYTE_MASK),
(byte)((bytes >>> 8) & BYTE_MASK),
(byte)((bytes ) & BYTE_MASK)
};
}
But FindBugs
in Eclipse
generates bugs: INT_VACUOUS_BIT_OPERATION
.
INT_VACUOUS_BIT_OPERATION: bit operations that don't do any meaningful work.
Why is that and how to fix it?