import javax.management.RuntimeErrorException;
public class Test11 {
public static void main(String[] args) {
//1.有一身份证号,判断此为男还是女,基于此方法,写一个算法,判断一个身份证号为男还是女。
////2.求出字符串中有多少种字符,以及每个字符的个数
// static void printCharInfo(String str)
// 例如有字符串 str="apple is a apple.";
System.out.println(isMan("203000199511502212"));
printchar("apple is an apple.");
}
public static void printchar(String str){
while(str.length()!=0){
String b=str.substring(0, 1);
int oldlength=str.length();
str=str.replace(b,"");
System.out.println(b+":"+(oldlength-str.length()));
}
}
public static boolean isMan(String id){
if(id.length()!=15 && id.length()!=18) {
throw new RuntimeException("输入信息有误");
}
int value=0;
if(id.length()==15){
value=Integer.valueOf(id.substring(14));
}else{
value=Integer.valueOf(id.substring(16, 17));}
if (value%2==0){
return false;
}else{
return true;
}
}
}