Exception in thread "main" java.lang.NullPointerException
at l2ex9.Main.main(Main.java:26)
Java Result: 1
package l2ex9;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String n1,n2;
int nn1, nn2;
int[] nd1 = null, nd2 = null;
int x,y;
int contOfEq=0;
Scanner s= new Scanner(System.in);
System.out.println("entre com o N1 ");
n1=s.nextLine();
nn1=Integer.parseInt(n1);
System.out.println("entre com o N2 ");
n2=s.nextLine();
nn2=Integer.parseInt(n2);
x=0;
while(x<=n1.length()){
nd1[x]=nn1%(10*(x+1));
}
x=0;
while(x<=n2.length()){
nd2[x]=nn2%(10*(x+1));
}
x=0;
y=0;
while(x<n1.length())
{
while(y><n2.length())
{
if(nd2[y]==nd1[x])
{
contOfEq=contOfEq+1;
}
y=y+1;
}
x=x+1;
}
if(contOfEq==n1.length())
{
System.out.print("é permutação ");
}
else if(contOfEq!=n1.length())
{
System.out.print("não é permutação ");
}
}
}

