Rotations of a Binary String with Odd Value | Java program to find count of rotations with odd value . ; function to calculate total odd decimal equivalent ; Driver code
class solution { static int oddEquivalent ( String s , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '1' ) count ++ ; } return count ; } public static void main ( String ar [ ] ) { String s = "1011011" ; int n = s . length ( ) ; System . out . println ( oddEquivalent ( s , n ) ) ; } }