I want to convert this VB.NET code to use in an Android Studio Project (JAVA)
Imports System.Text
Imports System.Security.Cryptography
Public Class Form1
Public Function md5hash(ByVal txt As String)
Dim md5 As MD5 = New MD5CryptoServiceProvider
md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(txt))
Dim reslt As Byte() = md5.Hash
Dim strbuilder As New StringBuilder
For i As Integer = 0 To reslt.Length - 1
strbuilder.Append(reslt(i).ToString("x2"))
Next
Dim ss As String = strbuilder.ToString
Dim newss As String = ss.Substring(0, 4) + "-" + ss.Substring(4, 4) + "-" + ss.Substring(8, 4) + "-" + ss.Substring(12, 4) + "-" + ss.Substring(16, 4)
Return newss.ToUpper
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TxtKey.Text = md5hash(TxtID.Text)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
How can I do this? To convert VB.NET Visual Basic 2010 script into android studio java