```{Convert TBytes to Integer}
procedure TForm1.Button1Click (Sender: TObject);
var
bs: TBytes; {TBytes is a dynamic array of Bytes}
i: Integer;
begin
{It should be the same size as Integer for conversion}
SetLength (bs, 4);
bs [0]: = \$ 10;
bs [1]: = \$ 27;
bs [2]: = 0;
bs [3]: = 0;

{Because TBytes is a dynamic array, so its variable bs is a pointer; so convert to PInteger first}
i: = PInteger (bs) ^;
ShowMessage (IntToStr (i)); {10000}
end ;

{Conversion from Bytes static array to Integer will be more convenient}
procedure TForm1.Button2Click (Sender: TObject);
var
bs:array [0..3] of Byte;
i: Integer;
begin
bs [0]: = \$ 10;
bs [1]: = \$ 27;
bs [2]: = 0;
bs [3]: = 0;

i: = Integer (bs);
ShowMessage (IntToStr (i)); {10000}
end ;

{Convert to custom structure}
procedure TForm1.Button3Click (Sender: TObject);
type
TData =packed record
a: Integer;
b: Word;
end ;
var
bs:array [0..5] of Byte; {This array should be the same size as the structure}
data: TData;
begin
FillChar (bs, Length (bs),0);
bs [0]: = \$ 10;
bs [1]: = \$ 27;

data: = TData (bs);
ShowMessage (IntToStr (data.a)); {10000}
end ;

{Convert to a member of the custom structure}
procedure TForm1.Button4Click (Sender: TObject);
type
TData =packed record
a: Integer;
b: Word;
end ;
var
bs:array [0..3] of Byte;
data: TData;
begin
FillChar (bs, Length (bs),0);
bs [0]: = \$ 10;
bs [1]: = \$ 27;

data.a: = Integer (bs);
ShowMessage (IntToStr (data.a)); {10000}
end ;

```