|  |  |  | 
|---|
|  |  |  | package com.ard.utils.tcp; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.ard.utils.ByteUtils; | 
|---|
|  |  |  | import com.ard.utils.other.ByteUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.xml.bind.DatatypeConverter; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | 
|---|
|  |  |  | // System.out.println(DatatypeConverter.printHexBinary(payload)); | 
|---|
|  |  |  | //计算负载的crc32值 | 
|---|
|  |  |  | byte[] NewCrc32 = ByteUtils.parseCrc32(payload); | 
|---|
|  |  |  | System.out.println("old:"+DatatypeConverter.printHexBinary(oldCrc32)); | 
|---|
|  |  |  | System.out.println("new:"+DatatypeConverter.printHexBinary(NewCrc32)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断数据的crc32校验值和计算值是否相同 | 
|---|
|  |  |  | if (Arrays.equals(oldCrc32, NewCrc32)) { | 
|---|
|  |  |  | return true; | 
|---|