public static Object deserializeFromBytes(byte data[]) throws IOException, ClassNotFoundException {
    ByteArrayInputStream stream = new ByteArrayInputStream(data);
    try {
      ObjectInputStream in = new ObjectInputStream(stream);
      try {
        Object object = in.readObject();
        return object;
      }
      finally {
        in.close();
      }
    }
    finally {
      if (stream != null) {stream.close();}
    }
  }