import java.util.Arrays;
import java.io.*;
import static  BH.Bytes_Hex.*;

public class TestBH {
    public static void main(String[] args){
        new TestBH().testit();
    }
    public void testit(){
        String test="Code it.";
        System.out.println("--The Test String: \n"+test);
        byte[] theBytes = String2ByteArray(test);
        System.out.println("As a byte Array: "+Arrays.toString(theBytes));
        String hexstring=ByteArray2HexString(theBytes);
        System.out.println("As a Hex String: "+hexstring);
        char[] theHexes= hexstring.toCharArray();
        System.out.println("As a Hex Array: "+Arrays.toString(theHexes));
        System.out.println("Back to the String: "+ ByteArray2String(HexArray2ByteArray(theHexes)));
        System.out.println("\n--In One Step:");
        String ashex=String2HexString(test);
        System.out.println("String to Hex String: "+ashex);
        System.out.println("Hex String to String: "+HexString2String(ashex));
        System.out.println("\n--Objects:");
        student jones=new student("jones","senior",90);
        byte[] baj=Object2ByteArray((Object)jones);     
        System.out.println("Object to HexString: \n"+ByteArray2HexString(baj)); 
        student jones1=(student)ByteArray2Object(baj);
        System.out.println("Back to student and get name:\n"+jones1.name);

    }
    public TestBH(){}
}



class student implements java.io.Serializable {
    public String name;
    public String year;     //Frosh, Soph, Jr, Senior,Year 1,Year 2,Year 3
    public int testgrade;   //entrance exam grade

    public student(String s,String y,int t){
        name=s;
        year=y;
        testgrade=t;
    }
}