In JavaSocketBridge, added new bytes2Hex which takes the length.
Use this from get to only return the buffer bytes up to position().
This resolves bug:
http://sea.remap.ucla.edu:8080/issues/96
diff --git a/java/JavaSocketBridge.java b/java/JavaSocketBridge.java
index ccaa6b4..988f758 100644
--- a/java/JavaSocketBridge.java
+++ b/java/JavaSocketBridge.java
@@ -167,7 +167,7 @@
 									buffer.clear();  

 									sChannel.read(bufferReceiver);

 

-									String output =  bytes2Hex(bufferReceiver.array());

+									String output =  bytes2Hex(bufferReceiver.array(), bufferReceiver.position());

 									System.out.println("RECEIVED BYTES:" +output);

 

 									result=output;

@@ -492,13 +492,13 @@
 

 		return bytes;

 	}

-	public static String bytes2Hex(byte[] b)

+	public static String bytes2Hex(byte[] b, int length)

 	{

 		// String Buffer can be used instead

 		String hs = "";

 		String stmp = "";

 

-		for (int n = 0; n < b.length; n++)

+		for (int n = 0; n < length; n++)

 		{

 			stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));

 

@@ -511,7 +511,7 @@
 				hs = hs + stmp;

 			}

 

-			if (n < b.length - 1)

+			if (n < length - 1)

 			{

 				hs = hs + "";

 			}

@@ -519,6 +519,10 @@
 

 		return hs;

 	}

+	public static String bytes2Hex(byte[] b)

+	{

+		return bytes2Hex(b, b.length);

+	}

 

 

 	public static void main(String[] args) throws IOException {