Here you can find the source of toByteArray(String str)
Parameter | Description |
---|---|
str | a parameter |
public static final byte[] toByteArray(String str)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w .j av a 2s .c om*/ * Return a byte[] array from the string's chars, * ANDed to the lowest 8 bits. * * @param str * @return */ public static final byte[] toByteArray(String str) { byte[] retour = new byte[str.length()]; for (int i = 0; i < str.length(); i++) { retour[i] = (byte) (str.charAt(i) & 0xFF); } return retour; } }