Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public synchronized static void sortTwoArrays(Double[] queryList, Double[] secondList) {
        if (queryList.length != secondList.length) {
            throw new IllegalArgumentException("The lists have to be of equal size!");
        }
        int n = queryList.length;
        for (int i = 0; i < n; i++) {
            for (int j = n - 1; j > i; j--) {
                double one = queryList[j - 1].doubleValue();
                double two = queryList[j].doubleValue();
                if (one > two) {
                    queryList[j - 1] = two;
                    queryList[j] = one;

                    Double temp = secondList[j - 1];
                    secondList[j - 1] = secondList[j];
                    secondList[j] = temp;
                }
            }
        }
    }
}