Find letter 's position in Alphabet using Bit operation | Java implementation of the approach ; Function to calculate the position of characters ; Performing AND operation with number 31 ; Driver code
public class GFG { public static final int NUM = 31 ; static void positions ( String str , int n ) { for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( ( str . charAt ( i ) & NUM ) + " ▁ " ) ; } } public static void main ( String [ ] args ) { String str = " Geeks " ; int n = str . length ( ) ; positions ( str , n ) ; } }