Why test cases are failing for this

import java.util.*;
public class Main {
public static void main(String args[]) {

Scanner scn = new Scanner (System.in);
int N1 = scn.nextInt();
int N2 = scn.nextInt();

int count =0;
int i=1;
while(count<N1 && count<N2) {
int num = (3*i)+2;
i++;
if((num%N2)!=0)
{
System.out.println(num);
}
else
{
count++;
}

}
}
}

@Girish_Mohanty Bro this is not the correct code for conversion from binary to decimal format. The correct code for this problem is given below take reference from it.

public static void main(String[] args) {


	Scanner scn = new Scanner (System.in);
	int n = scn.nextInt();
	int num = n;
    int dec_value = 0;

    // Initializing base
    // value to 1, i.e 2^0
    int base = 1;

    int temp = num;
    while (temp > 0) {
        int last_digit = temp % 10;
        temp = temp / 10;

        dec_value += last_digit * base;

        base = base * 2;
    }

    System.out.println(dec_value);
}