Imports System
Module Program
' ------------------------------------------------------------
' ArrayToNumber
' Converts an int() into a single integer by concatenating
' each element as a string. Works for multi-digit numbers.
' Example: {14, 6, 9, 31, 20} ->14693120
' ------------------------------------------------------------
Function ArrayToNumber(arr As Integer()) As Integer
Dim s As String = ""
For Each num As Integer In arr
s &= num.ToString() ' concatenate as text
Next
Return Integer.Parse(s) ' convert final string to int
End Function
Sub Main()
Dim arr As Integer() = {14, 6, 9, 31, 20}
Dim n As Integer = ArrayToNumber(arr)
Console.WriteLine("n = " & n)
End Sub
End Module
' run:
'
' n = 14693120
'