多亏了索蒂里奥斯,以下是正确答案:
//convert long to char array
long longValZ = 219902744986400000L;
ByteBuffer bbX = ByteBuffer.allocate(8);
bbX.putLong(longValZ);
char [] charArr1 = new char[4];
charArr1[0] = bbX.getChar(0);
charArr1[1] = bbX.getChar(2);
charArr1[2] = bbX.getChar(4);
charArr1[3] = bbX.getChar(6);
//convert char array to long
ByteBuffer bbY = ByteBuffer.allocate(8);
bbY.putChar(0,charArr1[0]);
bbY.putChar(2,charArr1[1]);
bbY.putChar(4,charArr1[2]);
bbY.putChar(6,charArr1[3]);
long longValY = bbY.getLong(0);