Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static int[] getAntennaTestData(String rotation, String funCode) {
        List<Integer> dateItem = new ArrayList();
        dateItem.add(Integer.valueOf(funCode));
        int intStep = Integer.valueOf(rotation) * 10;
        String hexStep = Integer.toHexString(intStep);

        if (hexStep.length() < 4) {
            switch (hexStep.length()) {
            case 1:
                hexStep = "000" + hexStep;
                break;
            case 2:
                hexStep = "00" + hexStep;
                break;
            case 3:
                hexStep = "0" + hexStep;
                break;
            }
        }
        dateItem.add(Integer.valueOf(hexStep.substring(2, 4), 16));
        dateItem.add(Integer.valueOf(hexStep.substring(0, 2), 16));
        for (int i = 0; i < 6; i++) {
            dateItem.add(0);
        }

        int[] message = new int[dateItem.size()];
        for (int i = 0; i < dateItem.size(); i++) {
            message[i] = dateItem.get(i);
        }

        return message;

    }
}