//将ip地址转换成一个长整型def ip2Long(str:String): Long &#61;{val fields: Array[String] &#61; str.split("\\.")var ipNum &#61; 0Lfor(field <- fields){ipNum &#61; field.toLong | ipNum <<8}ipNum}