Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;
import java.util.HashMap;

public class Main {
    public static HashMap<Integer, ArrayList<Double>> transposeHashMap(HashMap<Integer, ArrayList<Double>> data) {
        HashMap<Integer, ArrayList<Double>> dataT = new HashMap<Integer, ArrayList<Double>>();
        //transpose data to get data for each sensor channel
        for (int i = 0; i < data.get(0).size(); i++) {
            ArrayList<Double> tmp = new ArrayList<Double>();
            for (int j = 0; j < data.size(); j++) {
                tmp.add(data.get(j).get(i));
            }
            dataT.put(i, tmp);
        }
        return dataT;
    }
}