Results 1 to 3 of 3
Thread: (intValue % 2) vs (intValue & 1)
- 08-16-2012, 05:18 PM #1
Member
- Join Date
- Aug 2012
- Posts
- 1
- Rep Power
- 0
- 08-16-2012, 07:29 PM #2
Re: (intValue % 2) vs (intValue & 1)
Write a test program, compile it, use the javap command to disassemble the class file and see what code is generated for each.
In machine code, the AND would be a single instruction. I don't know what the compiler generates for %If you don't understand my response, don't ignore it, ask a question.
- 08-16-2012, 09:20 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: (intValue % 2) vs (intValue & 1)
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
parseInt() vs. intValue()
By JavaPilot in forum New To JavaReplies: 5Last Post: 02-04-2009, 08:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks