帮忙把这段JAVA程序翻译成C#版本的吧~~~~~~~~
public class CRC {
public static short crcRegInit = (short) 0xFFFF;
public static short CCITT16poly = 0x1021; /**
 * Use CCITT16 crc polynormial to generate CRC
 * 
 * @param message
 *            the byte buffer to be coded
 * @param offset
 *            the starting byte position (inclusively)
 * @param length
 *            the ending byte position (exclusively)
 * @return
 */
public static short crc16(byte[] message, int offset, int ending) {
short crcReg = crcRegInit;
for (int i = offset; i < ending; ++i) {
crcReg = singleByteCrc16(crcReg, CCITT16poly, message[i]);
}
return crcReg;
} public static short singleByteCrc16(short crcReg, short poly, byte data) {
int val = unsignedByte2int(data);//? int xorFlag;
short dcdBitMask = 0x0080; for (int i = 0; i < 8; ++i) {
xorFlag = crcReg & 0x8000;
crcReg <<= 1;
if ((val & dcdBitMask) == dcdBitMask)
crcReg |= 1; if (xorFlag != 0)
crcReg ^= poly; dcdBitMask >>= 1;
} return crcReg;
} /**
 * Append CCITT16 crc code to a byte buffer
 * 
 * @param message
 *            the message to be coded, assume it always has two extra bytes
 *            from the ending position
 * @param offset
 *            the starting byte position to calculate crc
 * @param ending
 *            the ending byte position (exclusive) to calculate crc
 */
public static void appendCRC16(byte[] message, int offset, int ending) {
short crc = crc16(message, offset, ending);
String crchex = Converters.int2hex(Converters.unsignedShort2int(crc));
byte[] crcbytes = Converters.hex2dec(crchex);
//by Leeric 2012.12.13, bug fix for small crc (1 byte)
if(crcbytes.length != 1) {
message[ending] = crcbytes[0];
message[ending + 1] = crcbytes[1];
}
else {
message[ending] = 0;
message[ending + 1] = crcbytes[0];
}
}}C#Java