Java Byte Array to Chinese bytesToGb2312(final byte[] bytes)

Here you can find the source of bytesToGb2312(final byte[] bytes)

Description

bytes To Gb

License

Open Source License

Declaration

public static String bytesToGb2312(final byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static final String GB2312 = "GB2312";

    public static String bytesToGb2312(final byte[] bytes) {
        return bytesToCharset(bytes, GB2312);
    }//from w  w w .j a  va  2 s  . c om

    public static String bytesToCharset(final byte[] bytes, final String charset) {
        try {
            return new String(bytes, charset);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}