Some tool is sending me Japanese content as byte array.
So using java I have to read that byte array and display the Japanese content.
I am not getting any ideas for achieving this.
Till now I tried with below mentioned program just to check how this conversion works:
String s= "業界支出TXT_20150130170955";
byte b1[];
try {
b1 = s.getBytes();
for (int j=0;j<b1.length; j++){
System.out.println(b1[j]+"-----------"+(char)b1[1]);
}
} catch (UnsupportedEncodingException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
Now this gives me some junk data. I know I am doing this entirely wrong but I am not getting any idea to read a byte stream to Japanese characters.
Any help would be appreciated.
Edit :1
WE NEED TO GET THE JAPANESE CHARS FROM "decoded" BYTE ARRAY I tried following things :
byte[] decoded = Base64.decodeBase64("qzD8MMkwGk/hVClSKHWCaYGJCP/GMK0wuTDIMAn/DQAKAA0ACgApUih1xzD8ML8w1lOXX+VlfgCgUt92l15qdfdTfgCgUt92l15+AClSKHVzijB9fgAakKiMfgB+AKsw/DDJMBpP4VQNVE1Sfg==");
try {
System.out.println(new String(decoded, "UTF-8") + "\n");
System.out.println(new String(decoded, "SHIFTJIS") + "\n");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
but we are not getting the expected results pls advide