Here you can find the source of charArrayToByteArray(final char[] message)
Parameter | Description |
---|---|
message | the message |
public static byte[] charArrayToByteArray(final char[] message)
//package com.java2s; public class Main { /**// w w w.j a v a 2s .c om * Char array to byte array. * * @param message * the message * @return the byte[] */ public static byte[] charArrayToByteArray(final char[] message) { final byte[] payload = new byte[message.length]; for (int i = 0; i < message.length; i++) { payload[i] = (byte) (message[i] & 0xFF); } return payload; } }