Here you can find the source of crc32(byte[] bytes)
public static String crc32(byte[] bytes)
//package com.java2s; /*/*from w w w . j ava 2 s . c om*/ * AlbatrossUtils.java * * Copyright (C) 2008 Mark Fenton * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { public static String crc32(byte[] bytes) { java.util.zip.CRC32 x = new java.util.zip.CRC32(); x.update(bytes); //java CRC is reversed (byte order) for what TS needs. SO.... String crcString = Long.toHexString(x.getValue()); //pad with leading 0s if (crcString.length() % 2 != 0) { crcString = "0" + crcString; } //reverse in pairs so bytes are in opposite order String reverseCrcString = crcString.substring(6, 8) + crcString.substring(4, 6) + crcString.substring(2, 4) + crcString.substring(0, 2); return reverseCrcString; } }