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[] addByte(byte[] a, byte b) {
        byte[] c;
        if (a == null) {
            c = new byte[1];
        } else {
            c = new byte[a.length + 1];
        }

        if (a != null) {
            System.arraycopy(a, 0, c, 0, a.length);
            System.arraycopy(new byte[] { b }, 0, c, a.length, 1);
        } else {
            c[0] = b;
        }

        return c;
    }
}