How to convert byteArray variables to HexaString variables for Linux?

Hello everybody,
I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given below:

//value in "byte in[] " stores dynamically..
                                byte ch = 0x00;
  int i = 0;
  if (in == null || in.length <= 0) {
   return null;
  }
  String pseudo[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
    "A", "B", "C", "D", "E", "F" };
  StringBuffer out = new StringBuffer(in.length * 2);
  while (i < in.length) {
   ch = (byte) (in & 0xF0); // Strip off high nibble
   ch = (byte) (ch >>> 4);
   // shift the bits down
   ch = (byte) (ch & 0x0F);
   // must do this is high order bit is on!
   out.append(pseudo[(int) ch]); // convert the nibble to a String
   // Character
   ch = (byte) (in & 0x0F); // Strip off low nibble
   out.append(pseudo[(int) ch]); // convert the nibble to a String
   // Character
   i++;
  }
  String rslt = new String(out);
  System.out.println("Hexa Value Buffer:"+out);

I want the same value in the variable out(String) for both Linux and Windows. For example, if I kept same value for variable byte in, then user made function in Windows and Linux will store different values in out String. Why is that?

I want the same value of Hexa in Linux also. How is it possible?
Can anybody tell me, what changes should be made in above code so that it works in Linux...
Thank you.

Stream of Hex 'EFBFBD' means encoding failed char at UTF-8.

Unicode Character 'REPLACEMENT CHARACTER' (U+FFFD)

So you need not to encoding.

Thank you for the suggestion..it worked...