title: Trying to convert from String to Int results in first character being a '?'
body: <p>I am working on the RSA coding system in school at the moment, however, there is a problem that neither I, nor my teacher can solve: </p>
  
  <p>When I try to decode the encoded text, the program returns the first character as a <code>?</code>, the rest of the string is correct. Maybe someone can help me, and if there are some other improvements that I could make.</p>
  
  <p>PS:Since I am german, some things might be in german, but they are irrelevant to the output/return. I have included the whole script for you to be able to run it completely and find the mistake I made faster. The console will ask you to input the following things:</p>
  
  <p>1.Anfang=Beginning of Array in which a Prime Number is picked</p>
  
  <p>2.Ende=End of Array</p>
  
  <p>3.Zahl die größer als 1, aber kleiner als phiN ist=put in any Prime number like 101, 13 and so on</p>
  
  <p>4.Put in any characters you like to code</p>
  
  <p>5.You get the uncoded text with an ? as the first character</p>
  
  <pre><code>package ggt;
  
  import java.util.Scanner;
  
  public class RSA {
  
      public static long Prim (long a, long b){
          boolean t = true;
          long primzahl =1;
          for (;a&lt;(b+1);a++){
              for (long i=2;i&lt;=(a/2)&amp;&amp;(t==true);i++){
                  if (a%i==0){
                      t=false;
                  }
  
              }
              if (t==true){
                  primzahl= a;
  
              }
              t=true;
          }
          return primzahl;
      }
      public static boolean ggt(long a, long b){
          long c=b;
          while(!(a%c==0&amp;&amp;b%c==0)){
                  c=c-1;
          }
          if (c == 1){
              return true;
          }else{
              return false;
          }
      }
      public static int[] extendedGcd(int x, int y){
          int u = 1;
          int v = 0;
          int s = 0;
          int t = 1;
          int q = 1;
          int ue[] = new int[3];
          while (y&gt;0){
              q = x/y;
              x = y;
              y = x-q*y;
              u = s;
              s = u-q*s;
              v = t;
              t = v-q*t;
          }
          ue[0]=x;
          ue[1]=u;
          ue[2]=v;
          return ue;
      }
      public static void main(String[]args){
              Scanner xx=new Scanner(System.in);
              System.out.println("Anfang");
              long a = xx.nextLong();
              System.out.println("Ende");
              long b = xx.nextLong();
              long p = Prim(a,b);
              System.out.println("Primzahl p= "+p);
              long q = Prim(3,a);
              System.out.println("Primzahl q= "+q);
              //public key
              long phiN = (p - 1) * (q - 1);
              System.out.println("e soll größer als 1, aber kleiner als phiN sein. phiN ist"+phiN);
              long e = xx.nextLong();
              long enn=p*q;
              if (e&lt;1){
                  System.out.println("e ist nicht korrekt. Wer lesen kann, schafft es durch die Schule.");
                  System.exit(0);}
          boolean be=ggt(e, phiN);
          if (!(be==true)){
              System.out.println("e ist nicht teilerfremd zu phiN");
              System.exit(0);
          }
          System.out.println("Der Public Key ist "+e+","+enn);
          //private key
          int d=1;
          while (!((e*d)%phiN==1)){
              d=d+1;
          }
          System.out.println("Der Private Key ist "+d+","+enn);
          System.out.println("Geben Sie bitte den zu verschlüsselnden Satz ein.");
          //Verschlüsselung
          Scanner yy=new Scanner(System.in);
          String uncoded=yy.nextLine();
          char []hj=uncoded.toCharArray();
          int j=0;
          long cancer;
          System.out.println("Der Verschlüsselte Text lautet(von oben nach unten):");
          for (int i=0; i != uncoded.length();i++){
              char character=uncoded.charAt(i);
              int ascii=(int)character;
              //System.out.println(ascii);
              //System.out.println(d);
              //System.out.println(enn);
              a=(long)(Math.pow(ascii, d));
              cancer=a%enn;
              //System.out.println(cancer);
              //System.out.println(a);
              cancer=((long)(Math.pow(cancer, e))%enn);
              hj[j]=(char)cancer;
          }System.out.println("Der entschlüsselte Text ist");
          System.out.println(hj);
      }
  }
  </code></pre>