tens,hundreds;doublepowsun;Stringtemp;for(;num<1000;num++){temp=Integer.toString(num);//将Int转换为Stringhundreds=Integer.parseInt(String.valueOf(temp.charAt(0)));//通过String的charAt函数获取指定位置的字符,然后通过Integer.parseInt将字符转换为Int类型数据。