File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fastest way to access certain digit in long

 
Hendra Kurniawan
Ranch Hand
Posts: 239
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lets say I have :


and I want to get the fourth digit from behind (in this case, the number would be 7). What's the fastest way to get this number? Is there any faster way than this?

 
Mike Simmons
Ranch Hand
Posts: 3028
10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that's the fastest way, right there.
 
Winston Gutkowski
Bartender
Pie
Posts: 9477
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hendra Kurniawan wrote:Is there any faster way than this?

Not unless you want to get really geeky

And I'd advise strongly against it.

Winston
 
Campbell Ritchie
Sheriff
Pie
Posts: 47280
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is much quicker if you want to access the i-th bit, or a digit in hexadecimal, which you can do with the << & and >> operators.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic