See last paragraph of https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html …
you can use an
AtomicInteger to hold
byte values, and cast appropriately. You can also hold doubles using
Double.longBitsToDouble(long) conversions… because there’s a valuable 1:1 mapping between a 64-bit number and a 64-bit float number.
- Useful if you need to precisely compare a 64-bit float value. For example, you can check if a value has changed at all. The value could be user-supplied or shared mutable.
- Useful if you need to store float values in a hashtable, though I’m not sure about performance.
- Useful if you need radix sort on floats