I'm trying to write kotlin code like:
for (byte b : hash)
stringBuilder.append(String.format("%02x", b&0xff));
but I have nothing to do with the "&". I'm trying to use "b and 0xff" but it doesn't work. The bitwise "and" seems to work on Int, not byte.
java.lang.String.format("%02x", (b and 0xff))
it's ok to use
1 and 0xff
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…