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[] encodeFloat(float payload)
    /*    */ {
        /* 27 */return encodeFloat(payload, new byte[4], 0);
        /*    */}

    public static byte[] encodeFloat(float payload, byte[] data, int offset) {
        /* 31 */return encodeInt(Float.floatToIntBits(payload), data, offset);
        /*    */}

    public static byte[] encodeInt(int payload) {
        /* 35 */return encodeInt(payload, new byte[4], 0);
        /*    */}

    public static byte[] encodeInt(int payload, byte[] data, int offset) {
        /* 39 */data[offset] = ((byte) (payload >> 24));
        /* 40 */data[(offset + 1)] = ((byte) (payload >> 16));
        /* 41 */data[(offset + 2)] = ((byte) (payload >> 8));
        /* 42 */data[(offset + 3)] = ((byte) payload);
        /* 43 */return data;
        /*    */}
}