I am reading a PDF file (as bytes) using this code
byte[] bytes=FileUtils.readFileToByteArray(pdf);
i want to convert this byte[] to base64 string and send it to a client.
I am getting String value as [B@42109d30
.
And I want to fill byte[]
with the same value [B@42109d30
.
I tried to fetch each character of string into a Byte
and then assign this Byte
value to byte[]
, but even then the final value of byte[]
changes.
String getbase64 = "[B@42109d30";
String a = String.valueOf((getbase64.charAt(i)));
if (a.equals("@") || a.equals("d") ) {
bytes[i]=0;
} else {
b = Byte.valueOf(""+a);
bt = b;
bytes[i] = bt;
Log.d("bytes", bytes.toString());
}
Please help,thank you