I wrote a code to send and receive packet using UDP protocol. When I received int, and I'm sure it's a number, I can't convert it from byte[] - which is the type of received packet - to an int. I tried to convert it from byte[] to String, and from String to int, but the same problem, I got the exception "NumberFormatException". My code to convert is:
  String newtext = new String (receivePacket.getData());
  System.out.println("I receive "+ newtext );
  int location = Integer.parseInt(newtext);
The output shown in console is a number, but the code can't see as a number. Any suggestion to solve it.