Four Bytes To Long : Byte « Date Type « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Date Type » Byte 
Four Bytes To Long
   

/*
 * This file is part of JSTUN. 
 
 * Copyright (c) 2005 Thomas King <king@t-king.de> - All rights
 * reserved.
 
 * This software is licensed under either the GNU Public License (GPL),
 * or the Apache 2.0 license. Copies of both license agreements are
 * included in this distribution.
 */
class Main{

  public static final long fourBytesToLong(byte[] valuethrows UtilityException {
    if (value.length < 4) {
      throw new UtilityException("Byte array too short!");
    }
        int temp0 = value[00xFF;
        int temp1 = value[10xFF;
    int temp2 = value[20xFF;
    int temp3 = value[30xFF;
        return (((long)temp0 << 24(temp1 << 16(temp2 << 8+ temp3);
  }  
  
}

class UtilityException extends Exception {
  private static final long serialVersionUID = 3545800974716581680L;

  UtilityException(String mesg) {
    super(mesg);
  }

}

   
    
    
  
Related examples in the same category
1.Byte Convert
2.unsigned Byte To Int
3.Bytes to KB
4.Byte Converter
5.byte To Unsigned Int
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.