public class SerializeDate
{
static void serialize( String filename )
{
try
{
FileOutputStream file = new FileOutputStream( filename );
ObjectOutputStream o = new ObjectOutputStream( file );
o.writeObject ( "Today" );
o.writeObject ( new Date() );
o.close();
}
catch ( IOException e ) { System.err.println( e ); }
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(new Date());
byte[] b = bos.toByteArray();
for(byte _b : b){
int i = _b;
System.out.print(Integer.toHexString(i) + " ");
}
oos.close();