Android String to Byte Array Convert StringtoByte(String data)

Here you can find the source of StringtoByte(String data)

Description

Stringto Byte

Declaration

public static byte[] StringtoByte(String data) 

Method Source Code

//package com.java2s;
import java.io.UnsupportedEncodingException;

public class Main {
    public final static String DEFAULT_CHARSET = "UTF-8";

    public static byte[] StringtoByte(String data) {
        try {//  w  w w  .  ja va  2 s .  c o  m
            return data.getBytes(DEFAULT_CHARSET);
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. fromString(String str)
  2. hexStringToByteArray(String hexa)
  3. toByte(String hexString)
  4. toByte(String hexString)
  5. toBytes(final String str)
  6. getLengthByByte(String str)
  7. bytesStorage(String str)
  8. bytesStorage(String str)
  9. getBytes(String s)