How to convert byte array to String [Kotlin]

In order to convert a byte array to String, you can make use of the String construction that takes in a byte array as an input argument,

fun main() {
    val byteArray = byteArrayOf(80,81,83,84,85,86)
    val myStr = String(byteArray)


Have Questions? Post them here!

Recent Posts:

Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.