Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static byte[] UdpHexDecode(String s) {
        byte abyte0[] = new byte[s.length() / 2];
        String s1 = s.toLowerCase();
        for (int i = 0; i < s1.length(); i += 2) {
            char c = s1.charAt(i);
            char c1 = s1.charAt(i + 1);
            int j = i / 2;
            if (c < 'a')
                abyte0[j] = (byte) (c - 48 << 4);
            else
                abyte0[j] = (byte) ((c - 97) + 10 << 4);
            if (c1 < 'a')
                abyte0[j] += (byte) (c1 - 48);
            else
                abyte0[j] += (byte) ((c1 - 97) + 10);
        }
        return abyte0;
    }
}