Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// it under the terms of the GNU General Public License as published by

public class Main {
    public static byte[] toBytesFromUnicode(String s) {
        int limit = s.length() * 2;
        byte[] result = new byte[limit];
        char c;
        for (int i = 0; i < limit; i++) {
            c = s.charAt(i >>> 1);
            result[i] = (byte) (((i & 1) == 0) ? c >>> 8 : c);
        }
        return result;
    }
}