private int[] getSize(Scanner scanner){
        int[] size = new int[2];
        String regex = "[0-9]+";
        System.out.println("Anna kartan mitat: ");
        System.out.println("Korkeus: ");
        String measure = scanner.nextLine();
        while(!measure.matches(regex)){
            System.out.println("Korkeus: ");
            measure = scanner.nextLine();
        }
        size[0]=Integer.parseInt(measure);
        while(size[0]<3 || size[0]>50){
            System.out.println("Anna korkeus, joka on suurempi kuin 2 ja pienempi kuin 50: ");
            System.out.println("Korkeus: ");
            measure = scanner.nextLine();
            size[0]=Integer.parseInt(measure);
        }
        regex = "[0-9]+";
        System.out.println("Leveys: ");
        measure = scanner.nextLine();
        while(!measure.matches(regex)){
           System.out.println("Leveys: ");
           measure = scanner.nextLine(); 
        }
        size[1]=Integer.parseInt(measure);
        while(size[1]<3 || size[1]>50){
            System.out.println("Anna leveys, joka on suurempi kuin 2 ja pienempi kuin 50: ");
            System.out.println("leveys: ");
            measure = scanner.nextLine();
            size[1]=Integer.parseInt(measure);
        }
        return size;
    }