This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
To all JavaRanch members: thanks for the help. I have yet another question for you today. I have a class with a method that performs bitwise logic [int add(int a, int b) and int sub(int a, int b)]. Here's an example:
Now say I have a String of 1's and 0's(or an int composed of 1's and 0's, whichever one is more appropriate [?]). I want to process each character with the corresponding character in a second String, equal length. For instance:
I tried a lot of b.add((int)x.charAt(i), (int)y.charAt(i)); using the string method desribed, but I wound up with 97's and 98's. Do you think I should incorporate a loop into the bit class, and change it so it handles Strings? But how do I get to the point where I have an easy-to-work-with Integer = 1/0?