View Single Post
  #9 (permalink)  
Old 07-04-2009, 03:31 AM
Saradus Saradus is offline
Member
 
Join Date: Jul 2009
Posts: 14
Rep Power: 0
Saradus is on a distinguished road
Default
Originally Posted by angryboy View Post
Code:
for(int i = 1; i <= vs1; i++) {
  vArray1[vMax-i] = Integer.parseInt(v1.substring(vs1-i,vs1-i+1));
  vArray1[vMax-i] = Integer.parseInt(Character.toString(v1.charAt(vs1-i)));
  vArray1[vMax-i] = Character.digit(v1.charAt(vs1-i),10); //short ;-)
}
I will have to play around w/ this over the weekend before I can comment any further. Right now, I believe this is extremly resource hungry for large numbers because you are creating two arrays with the same size just to align the digits. So if you have a long number, say 64kb long, you will need to create two arrays of 64kb long.
Ah! Yes thats a much better idea, much neater! I see what you're saying about the array sizes, that's not something I'd considered and a very valid point! I'll have a look at my code and see if there's a way to solve this, thanks for your continued input!
Reply With Quote