text: Check if lowercase and uppercase characters are in same order | Java program to check if lowercase and uppercase characters are in same order ; Function to check if both the case follow the same order ; Traverse the string ; Store both lowercase and uppercase in two different strings ; transform lowerStr1 to upper ; Driver code
code: public class GFG { static boolean isCheck ( String str ) { int len = str . length ( ) ; String lowerStr = " " , upperStr = " " ; char [ ] str1 = str . toCharArray ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( ( int ) ( str1 [ i ] ) >= 65 && ( int ) str1 [ i ] <= 91 ) upperStr = upperStr + str1 [ i ] ; else lowerStr = lowerStr + str1 [ i ] ; } String transformStr = lowerStr . toUpperCase ( ) ; return ( transformStr . equals ( upperStr ) ) ; } public static void main ( String [ ] args ) { String str = " geeGkEEsKS " ; if ( isCheck ( str ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }