Kotlin decode base64

import java.util.Base64
 
fun main() {
    val string = "Some text"
 
    // encode a string using Base64 encoder
    val encoder: Base64.Encoder = Base64.getEncoder()
    val encoded: String = encoder.encodeToString(string.toByteArray())
    println("Encoded Data: $encoded")
 
    // decode the encoded data
    val decoder: Base64.Decoder = Base64.getDecoder()
    val decoded = String(decoder.decode(encoded))
    println("Decoded Data: $decoded")
}
Thankful Toucan