Find upper and lower case from string.

Find upper and lower case from string.

Write a Java program to find the upper and lower case from string and print count.

import java.util.*;

import static java.lang.System.in;

public class demo {
    public static void main(String[] args) {
        String str = "Gulshan Kumar";
        int len = str.length();
        String capsString = "";
        String smallString = "";
        int small = 0;
        int caps = 0;

        for (int i=0; i<len; i++){
//            The range A-Z is mapped to [65-90]
//            nd [a-z] is mapped to [97-122]
            if (str.codePointAt(i)>64 && str.codePointAt(i)<91){
                capsString += str.charAt(i)+" ";
                caps++;
            } else if (str.codePointAt(i)>96 && str.codePointAt(i)<123) {
                smallString += str.charAt(i)+" ";
                small++;

            }

        }
        System.out.println("Small letters in String are : "+smallString +
                "\nand count of the letters is : "+ small);

        System.out.println("***********************************");

        System.out.println("Capital letters in String are : "+capsString +
                "\nand count of the letters is : "+ caps);


    }
} // main block

/*
output 
Small letters in String are : u l s h a n u m a r 
and count of the letters is : 10
***********************************
Capital letters in String are : G K 
and count of the letters is : 2
*/