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!
    Bookmark Topic Watch Topic
  • New Topic

Bit Scan Forward in java

 
vikas sharmaa
Ranch Hand
Posts: 191
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
how can we implement BSF(Bit Scan Forward) assembly code in java in the most efficient way.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
If you've got Jdk 5 or later, check out Integer.numberOfLeadingZeros() and Integer.numberOfTrailingZeros(). Or the same methods in class Long. Otherwise, you have to write a loop to do it with bitshifting and a bitmask. Do you have an application with a real need for this, or is it a homework problem?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Vikas' question is about a chess program, see this topic in the Game Development forum: Java Chess Game I made by my self
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hm, well since the original post has a lot more useful context, I think I'll close this thread and follow up there instead.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic