Create BigInteger from a byte array in CSharp

Description

The following code shows how to create BigInteger from a byte array.

Example


/*  www  .  j  a  v  a 2 s. co m*/

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
        byte[] bytes = { 5, 4, 3, 2, 1 };
        BigInteger number = new BigInteger(bytes);
        Console.WriteLine("The value of number is {0} (or 0x{0:x}).", number); 

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var