Need a big JAVA help

djHiran

Well-known member
  • Oct 6, 2006
    2,764
    295
    83
    USA
    I wrote an app using VB6.

    That is a very simple app which gets a text input and read it letter by letter and get the ASCII values of the text, and XOR the values with AA (hex) (or 170- binary 10101010) if not ASCII = 13 or 10, and output the processed one back as a string.

    1. Get text input
    2. For each letter in the text, get their ASCII values
    3. For each letter, if not ASCII = 13 or 10, XOR the value with 170, if its 13 or 10, just pass the letter to the next step
    4. Recombine each letter to a new string
    5. output the string as a text

    I want somebody to create the same app with JAVA (to run on OSX?

    Here is the vb code I wrote
    Code:
    [FONT="Lucida Console"]Private Sub Command1_Click()
    Dim sInput, sOutput As String
    Dim i As Integer
    Dim s As String * 1
    
    sInput = Trim(Text1.Text)
    If Len(sInput) Then
    	For i = 1 To Len(sInput)
    		s = Mid(sInput, i, 1)
    		If Not ((Asc(s) = 13) Or (Asc(s) = 10)) Then
    			sOutput = sOutput & Chr(Asc(s) Xor 170)
    		Else
    			sOutput = sOutput & s
    		End If
    	Next i
    End If
    
    Text1.Text = sOutput
    End Sub[/FONT]

    Can someone do this big help for me?