I am working with a binary of length n, and I need to rotate it 2n times and perform some calculations. However, it becomes expensive when n exceeds 42, as I have to perform these operations trillions of times and more. Is there a way to do this directly with vanilla Java to reduce my computations as much as possible?
I don’t want to convert to string or any such method due to high computations
I have used
String shiftedBinary = currentBinary.substring(1) + currentBinary.charAt(0)
I have also tried using StringBuilder, or using numerical values with long type for the binary number but it’s still expensive in the long run