Lower case to upper case | Java program to convert a string to uppercase ; Converts a string to uppercase ; Driver code
class GFG { static String to_upper ( char [ ] in ) { for ( int i = 0 ; i < in . length ; i ++ ) { if ( ' a ' <= in [ i ] & in [ i ] <= ' z ' ) { in [ i ] = ( char ) ( in [ i ] - ' a ' + ' A ' ) ; } } return String . valueOf ( in ) ; } public static void main ( String [ ] args ) { String str = " geeksforgeeks " ; System . out . println ( to_upper ( str . toCharArray ( ) ) ) ; } }