Click here to watch in Youtube :
https://www.youtube.com/watch?v=GHx2krleswU&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java String [getBytes() method] |
/* * public byte[] getBytes() * * Encodes this String into a sequence of bytes * using the platform's default charset, storing the * result into a new byte array. * * Returns: * ------- * The resultant byte array */ public class GetBytesDemo { public static void main(String[] args) { String str = "Hi"; byte[] byteArray = str.getBytes(); System.out.println("byteArray of \"Hi\" = " + byteArray); for (byte b : byteArray) { System.out.println(b); } } }
byteArray of "Hi" = [B@659e0bfd 72 105
Refer:
https://sites.google.com/site/javaee4321/java/StringDemo_getBytes_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_getBytes_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/219b10088440d75a7105e6bff5bbab9e88ad9a80/BasicJava/StringDemo_getBytes_App/?at=master
See also:
No comments:
Post a Comment