Chandra shekar M wrote:you are correct I have to correct if( (val & shifted) > 0) to if( (checker & shifted) > 0).
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Chandra shekar M wrote:Ok here is my explanation
1. ASCII character size is 256, as java is unicode double byte characters...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Chandra shekar M wrote:I deciphered the algorithm, by debugging it.
Where did you get those figures from? By the way: they are both wrong.Chandra shekar M wrote:Ok here is my explanation
1. ASCII character size is 256 . . . characters we have 2^15= 32768 characters. . . ,
There are three kinds of actuaries: those who can count, and those who can't.
Campbell Ritchie wrote:
Where did you get those figures from? By the way: they are both wrong.Chandra shekar M wrote:Ok here is my explanation
1. ASCII character size is 256 . . . characters we have 2^15= 32768 characters. . . ,
Piet Souris wrote:ah well, a little bit shuffling never hurt anybody!
A more serious problem with the method is that it is wrong.
With the corrected code:
the output is
So you should take a long enough BitSet for your 'checker'.
Chandra shekar M wrote:how big it should be then?
Piet Souris wrote:ah well, a little bit shuffling never hurt anybody!
A more serious problem with the method is that it is wrong.
With the corrected code:
the output is
So you should take a long enough BitSet for your 'checker'.
Chandra shekar M wrote:Corrected code [...] should fix the issue
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:In principal, there is nothing wrong...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Where on earth did you get that from?Piet Souris wrote:. . . But BigInteger is a bit dangerous to use.. . .
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |