toString(): This method is available in java.nio.ByteBuffer class of Java.
Syntax:
String java.nio.ByteBuffer.toString()
This method returns a string summarizing the state of this buffer.
Parameters: NA
Returns: A summary string.
Exceptions: NA
Approach
Java
import java.nio.ByteBuffer;public class ByteBuffertoString {public static void main(String[] args) {byte array[] = { 1, 2, 3, 4 };ByteBuffer bb = ByteBuffer.wrap(array);System.out.println(bb.toString());}}
Output:
java.nio.HeapByteBuffer[pos=0 lim=4 cap=4]
No comments:
Post a Comment