title: Difference between ByteArray and Array<Byte> in kotlin
body: <p>I don't understand why e.g. the <code>java.security.MessageDigest.digest()</code> method which is declared as returning <code>byte[]</code> in Java returns a <code>ByteArray</code> in Kotlin although Kotlin usually seems to call <code>byte[]</code> an <code>Array&lt;Byte&gt;</code>.</p>
  
  <p>E.g. the following does not work:</p>
  
  <pre><code>fun main(args : Array&lt;String&gt;) {
    val md = java.security.MessageDigest.getInstance("SHA")
    if (md == null) throw NullPointerException()
    val result : Array&lt;Byte&gt;? = md.digest() 
  }
  </code></pre>
  
  <p>Type mismatch: inferred type is <code>ByteArray?</code> but <code>Array&lt;Byte&gt;?</code> was expected</p>