A simple problem

import java.io.*;

class test

{

public static void main(String[] args)

{

String mess = "This is a message";

System.out.println("mess is : " + mess);

byte[] b = mess.getBytes();

int len = mess.length();

System.out.println("Length is : " + len);

String newMess = b.toString();

System.out.println("newMess is : " + newMess);

}

}

Can anyone let me know how to convert the byte array 'b' back into a string?

Steve

PS

I finally got my file transfer to work thorugh sockets using the datainputstreams, and dataoutputstreams, and sending over packets off bytes etc, cheers for the help on that one.

[700 byte] By [steventweedy] at [2007-9-27 17:22:11]
# 1
use the constructor:String newMess = new String(b);
nimal1357 at 2007-7-6 12:16:40 > top of Java-index,Archived Forums,Java Programming...
# 2
cheers mate.Steve
steventweedy at 2007-7-6 12:16:40 > top of Java-index,Archived Forums,Java Programming...