Commons-Lang3のArrayUtilsを使えば変換できます(やっていることは同じですが…)
java
1import org.apache.commons.lang3.ArrayUtils;
2
3public class ToBytes {
4
5 public static void main(String[] args) {
6 byte[] b = new String("あいうえお").getBytes();
7 Byte[] cb = ArrayUtils.toObject(b);
8 // ......
9 byte[] xb = ArrayUtils.toPrimitive(cb); // Byte[] → byte[]
10 }
11}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/22 06:07
2016/08/22 06:17
2016/08/22 06:23