Thanks for the reply. I understand DH is used to exchange keys or insecure channels. The public key I am talking about is the Alice and Bob public keys they exchange during their DH besides the P and G values.
The problem I am having now is not how to extract the byte[] from the public key but how do I recreate the byte[] of the public key sent across the network into a PublicKey object again. I have looked through the PublicKey
java doc but it seems like there is no direct way for using the transfered byte[] and re-assemble them back to PublicKey objects.