I have a strange scenario where I need to convert several million java.lang.Long to primitive int types. I need to do this several times a day, every day. Normally, I would not worry about this simple casting, but since it happens so often, so often, I have to ask: what is the most effective way to do this and why?
My first attempt:
Long myLong = getLong(); int x = Integer.valueOf(myLong.toString())
Although it looks like 3 sides around the barn. Thanks in advance.
IAmYourFaja
source share