title: required String[] found String Java
body: <p>Im trying to cycle through a byte array and decode it into a string, using RSA encryption, the encryption works with out an array but I am trying to make it usable for longer data, by encrypting each word of the string, but when doing this i get the error required String[] found String Java. </p>
  
  <pre><code> // Decrypt the cipher text using the private key.
          inputStream = new ObjectInputStream(new FileInputStream(PRIVATE_KEY_FILE));
          final PrivateKey privateKey = (PrivateKey) inputStream.readObject();
          String[][] decryptedText = new String[cipherText.length][];
          for (int i = 0; i &lt; cipherText.length; i++) {
              **ERROR ON THIS LINE - required String[] found String Java**
           decryptedText[i] = decrypt(cipherText[i], privateKey);
  
          }
  </code></pre>
  
  <p>the decrypt method</p>
  
  <pre><code>  public static String decrypt(byte[] text, PrivateKey key) {
      byte[] dectyptedText = null;
      try {
          // get an RSA cipher object and print the provider
          final Cipher cipher = Cipher.getInstance(ALGORITHM);
          // decrypt the text using the private key
          cipher.init(Cipher.DECRYPT_MODE, key);
          dectyptedText = cipher.doFinal(text);
  
      } catch (InvalidKeyException | NoSuchAlgorithmException | BadPaddingException |IllegalBlockSizeException | NoSuchPaddingException ex) {
      }
  
      return new String(dectyptedText);
  }
  </code></pre>
  
  <p>Encrypt Method</p>
  
  <pre><code>public static byte[] encrypt(String text, PublicKey key) {
      byte[] cipherText = null;
      try {
          // get an RSA cipher object and print the provider
          final Cipher cipher = Cipher.getInstance(ALGORITHM);
          // encrypt the plain text using the public key
          cipher.init(Cipher.ENCRYPT_MODE, key);
          cipherText = cipher.doFinal(text.getBytes());
      } catch (InvalidKeyException | NoSuchAlgorithmException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException e) {
      }
      return cipherText;
  }
  </code></pre>