In Java does anyone use short or byte?

前端 未结 11 923
挽巷
挽巷 2020-12-14 15:44

Apart from using (byte[]) in streaming I don\'t really see byte and short used much. On the other hand I have seen long used where the actual value is |100| and byte would b

11条回答
  •  醉酒成梦
    2020-12-14 15:52

    I used short extensively when creating an emulator based on a 16-bit architecture. I considered using char so I could have stuff unsigned but the spirit of using a real integer type won out in the end.

    edit: regarding the inevitable question about what I did when I needed the most significant bit: with the thing I was emulating it happened to almost never get used. In the few places it was used, I just used bitwise modifiers or math hackery.

提交回复
热议问题