As per your request, here's some examples of the equivalent code in Java...
The Basics
// Converts the string using the default character encoding
// (equivalent of Encoding.Default in C#).
byte[] bytes = text.getBytes();
// Converts the string using the given character encoding, in this case UTF-8.
byte[] bytes = text.getBytes("UTF-8");
// Converts a byte array to a string using the default encoding.
String text = new String(bytes);
// Converts a byte array to a string using the given encoding.
String text = new String(bytes, "UTF-8");
Code Example
public class EncodingTest {
public static void main(String[] args) {
try {
String originalText = "The quick brown fox jumped over the lazy dog.";
byte[] defaultBytes = originalText.getBytes();
byte[] utf8Bytes = originalText.getBytes("UTF-8");
byte[] utf16Bytes = originalText.getBytes("UTF-16");
byte[] isoBytes = originalText.getBytes("ISO-8859-1");
System.out.println("Original Text: " + originalText);
System.out.println("Text Length: " + originalText.length());
System.out.println("Default Bytes Length: " + defaultBytes.length);
System.out.println("UTF-8 Bytes Length: " + utf8Bytes.length);
System.out.println("UTF-16 Bytes Length: " + utf16Bytes.length);
System.out.println("ISO-8859-1 Bytes Length: " + isoBytes.length);
String newDefaultText = new String(defaultBytes);
String newUtf8Text = new String(utf8Bytes, "UTF-8");
String newUtf16Text = new String(utf16Bytes, "UTF-16");
String newIsoText = new String(isoBytes, "ISO-8859-1");
System.out.println("New Default Text: " + newDefaultText);
System.out.println("New UTF-8 Text: " + newUtf8Text);
System.out.println("New UTF-16 Text: " + newUtf16Text);
System.out.println("New ISO-8859-1 Text: " + newIsoText);
} catch (Exception e) {
e.printStackTrace();
}
}
}
More info on String constructors here.
And some further tutorials on Java encodings here.
And as I stated in comments, there is no such thing as "without encoding" for string/byte conversions. There may be an implicit or default encoding being used, but there's always an encoding required to convert from string to byte[] and vice versa.
Also: How to convert Java String into byte[]?