Reputation: 23
What's the java equivalent for
var arrayList = new ArrayList();
XXX Do some magic with arrayList. . .
return Encoding.UTF32.GetString(arrayList.ToArray(Type.GetType("System.Byte")) as byte[]);
from c# in java? I'm trying to encode a decrypted byte array via RSA decryption.
The way i'm approaching it is,
new String(retBal, Charset.forName("UTF-32"));
Where retBal is my byte[] array. It doesn't feel and look right. My return string comes out as
��������������������
Upvotes: 1
Views: 962
Reputation: 159175
Documentation for the .NET Encoding.UTF32
says:
Gets an encoding for the UTF-32 format using the little endian byte order.
In Java, character set UTF-32
is big endian by default (if no BOM is present).
To force little endian byte order, use UTF-32LE
.
Upvotes: 3