VB代码怎么转换成JAVA代码

Sub output()
On Error Resume Next
Dim I As Integer, J As Long, RW As Long, mypath As String
For I = 1 To Sheet5.UsedRange.Columns.Count
mypath = ThisWorkbook.Path & "" & Sheet4.Cells(3, I) & ".lrmx"
Set txt = CreateObject("scripting.filesystemobject").opentextfile(mypath, 2, True, -1)
For J = 1 To Cells(65536, I).End(3).Row
txt.writeline Cells(J, I).Value
Next J
txt.Close
Next I
MsgBox "数据导出完毕!", vbOKOnly, "导出成功"
End Sub

以上VB代码怎么转换成Java代码,请各位帮忙。