java基础
int类型转二进制
Scanner sc=new Scanner(System.in); int number=sc.nextInt(); StringBuffer sb=new StringBuffer(); for(int i=0;i<32;i++){ int val=number%2==0?0:1; sb.append(val); number>>=1; } sb.reverse(); String str=sb.toString();
java 正则表达式
String regex = "^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$"; flag = Pattern.matches(regex, ip);