Check if the String is Pangram

Check if the String is Pangram

A pangram is a sentence containing every letter in the English Alphabet.

String s = "abcdefghijklmnopqrstuvwxyz"

The above string contains all the alphabet so it is a pangram.

public class Panagram {
  public static void main(String[] args) {
    String s = "abcdefghijklmnopqrstuvwxyz";
    int[] arr = new int[26];
    for(char ch:s.toCharArray()){
      //here it stores the 1 in array of it's respected indexes
      arr[ch-'a'] = 1;
    }

    boolean ans=false;
    for(int i:arr){
      if(i==0){
        ans = false;
        break;
      }
      else{
        ans = true;
      }
    }
    System.out.println("Pangram: "+ans);
  }
}
Pangram: true

Pangram using HashMap:

public class Panagram {
  public static void main(String[] args) {
    String s = "abcdefghijklmnopqrstuvwxyz";
    HashMap<Character,Integer> map=new HashMap<>();
    for(int i=0;i<s.length();i++){
        map.put(s.charAt(i),1);
    }

    if(map.size() == 26){
        System.out.println("Pangram: "+true);
    }
    else{
      System.err.println("Pangram: "+false);
    }   
  }
}
Pangram: true

Pangram using HashSet:

public class Panagram {
  public static void main(String[] args) {
    String s = "abcdefghij";
    HashSet <Character> a=new HashSet<>();            
    if(s.length()>25)
    {
      for(int i=0;i<s.length();i++)
      {
        a.add(s.charAt(i));
      }        
    }
    boolean res = a.size()==26 ? true : false;
    System.out.println("Pangram: "+res);   
  }
}
Pangram: false