GKE Stackdriver BadRequestException

时间:2019-04-25 09:26:48

标签: php google-kubernetes-engine stackdriver

当我尝试编写条目时,出现异常:

import java.io.*;
import java.lang.*;

public class main {

    public static void merge(Integer[] gArray, int low, int mid1, int mid2, int mid3,
                             int high, Integer[] destArray)
    {
        int i = low, j = mid1, k = mid2, l = mid3, m = low;

        while (m < high) {
            if (i < mid1 && (j >= mid2 || gArray[i].compareTo(gArray[j]) <= 0)) {
                if (k >= mid3 || gArray[i].compareTo(gArray[k]) <= 0) {
                    if (l >= high || gArray[i].compareTo(gArray[l]) <= 0) {
                        destArray[m++] = gArray[i++];
                    } else {
                        destArray[m++] = gArray[l++];
                    }
                } else {
                    if (k < mid3 && (l >= high || gArray[k].compareTo(gArray[l]) <= 0)) {
                        destArray[m++] = gArray[k++];
                    } else {
                        destArray[m++] = gArray[l++];
                    }
                }
            } else {
                if (j < mid2 && (k >= mid3 || gArray[j].compareTo(gArray[k]) <= 0)) {
                    if (l >= high || gArray[j].compareTo(gArray[l]) < 0) {
                        destArray[m++] = gArray[j++];
                    } else {
                        destArray[m++] = gArray[l++];
                    }
                } else {
                    if (k < mid3 && (l >= high || gArray[k].compareTo(gArray[l]) <= 0)) {
                        destArray[m++] = gArray[k++];
                    } else {
                        destArray[m++] = gArray[l++];
                    }
                }
            }
        }
        for (int i = low; i < high; i++) {
            gArray[i] = destArray[i];
        }
    }

    public static void mergeSort4WayRec(Integer[] gArray, int low, int high,
                                        Integer[] tempArray) {
        if (high - low < 2) {
            return;
        }

        int mid1 = low  + (high - low + 0) / 4;
        int mid2 = mid1 + (high - low + 1) / 4;
        int mid3 = mid2 + (high - low + 2) / 4;

        mergeSort4WayRec(gArray, low,  mid1, tempArray);
        mergeSort4WayRec(gArray, mid1, mid2, tempArray);
        mergeSort4WayRec(gArray, mid2, mid3, tempArray);
        mergeSort4WayRec(gArray, mid3, high, tempArray);

        merge(gArray, low, mid1, mid2, mid3, high, tempArray);
    }

    public static void mergeSort4Way(Integer[] gArray) {
        if (gArray != null) {
            Integer[] tempArray = new Integer[gArray.length];
            mergeSort4WayRec(gArray, 0, gArray.length, tempArray);
        }
    }

    public static void main(String[] args) {
        Integer arr[] = { 3, 2, 4, 1, 99, 30, 5, 3, 3, 2, 4, 1, 99, 30, 5, 3,
            3, 2, 4, 1, 99, 30, 5, 3 };

        long ns = System.nanoTime();
        mergeSort4Way(arr);
        ns = System.nanoTime() - ns;

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println("\n" + arr.length + "elements sorted in " + ns + " ns");
    }
}

是否有写大条目的解决方案,或者有其他建议收集gke上的日志?

0 个答案:

没有答案