java - How to convert cases with bit manipulation? -


how can convert uppercase lowercase , vice versa using bit manipulation?

in ascii, uppercase characters prefixed 010 , 1-26 in binary [their location in alphabet]. lowercase prefixed 011.

by using bitwise or operand , 00100000 mask 0b00100000, 32 integer, can convert uppercase lowercase, , not change lowercase.

example

char character = 0b00100000 | 'a'; 

or

char character = 32 | 'a'; 

to convert uppercase, use

char character = 0b01011111 & 'a'; 

or

char character = 95 & 'a'; 

you may use way of representing 127 or 95 bitmask , operation.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -