Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Talk:How to swap variable values in Java ME using bitwise operations

From Wiki
Jump to: navigation, search

i do seriously doubt that this code is any faster than swapping using a temporary variable... i think that variable assignement is at least as fast as a binary operation, if not faster. your version is making 3 binary xor, a version using temp variable will be using 3 assignement and so the 2 will execute as fast.

Ya it's right but this concept is useful for memory utilization. because the third variable increases the memory size little bit.--vkmunjpara 10:18, 19 September 2009 (UTC)
19 Sep
Article Review by vkmunjpara (20090919)

Level: basic

This is a simple code but it uses a Bitwise XOR operator for swapping the values between two variables. So the extra third variable is not needed for swapping the values between variables.