Convert byte To Word - CSharp System

CSharp examples for System:Byte

Description

Convert byte To Word

Demo Code

/*/*  www. java2 s  .  co  m*/
    Convert between different array types
    Copyright (C) 2000-2007 Bob Mottram
    fuzzgun@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
using System;

public class Main{
        #region "bytes to words and dwords"
        
        public static int ToWord(byte low_byte, byte high_byte)
        {
            if (high_byte < 0x80)
                return( high_byte * 0x100 | low_byte);
            else
                return((high_byte |0xFF00) * 0x100 | low_byte);            
        }
}

Related Tutorials