is Subset between two int array - Java Collection Framework

Java examples for Collection Framework:Array Algorithm

Description

is Subset between two int array

Demo Code


//package com.java2s;

public class Main {
    public static boolean isSubset(int[] a, int[] b) {
        if (a.length != b.length)
            throw new IllegalArgumentException(
                    "Compared arrays must be the same length.");

        for (int i = 0; i < a.length; i++) {
            if (a[i] < b[i])
                return false;
        }/*from www  .j  av a 2 s .com*/

        return true;
    }
}

Related Tutorials