HOME      BLOG       FORUMS      CONTACT       ABOUT

Convert a binary String object to Byte.

The valueOf method of Byte class is used for converting a binary String to Byte object.

public class ByteWrapper {
	public static void main(String[] args) {
		String str = "1010";
		Byte objByte = Byte.valueOf(str, 2);
		System.out.println(objByte);
	}
}

Share

Tags: , , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

One Response to “Convert a binary String object to Byte.”

  1. Here the method in program was valueOf() not parseByte it was wrong entered in the program.so visitors please correct it.
    Thanks

Leave a Reply