Android Open Source - SmartEPW_Android_App Format Convert






From Project

Back to project page SmartEPW_Android_App.

License

The source code is released under:

MIT License

If you think the Android project SmartEPW_Android_App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.android.SmartEPW.util;
//from w ww.j a v a 2s.  co m
/**
 * Created by jackabk on 3/1/14.
 */
public class FormatConvert {

    /*this method is used by int to float scale.
    * @param intVal.
    * @return floatVal.
    */
    public static float IntToFloatByScale(int intVal , float scale){
        float floatVal;
        floatVal = ((float)intVal) * scale;
        return floatVal;
    }


    /*there is convert byteArray To int and inverse relative*/
    /*refer to http://stackoverflow.com/questions/5399798/byte-array-and-int-conversion-in-java */
    public  static  int byteArrayToInt(byte[] b) {
        return b[3] & 0xFF |
                (b[2] & 0xFF) << 8 |
                (b[1] & 0xFF) << 16 |
                (b[0] & 0xFF) << 24;
    }

    public static byte[] intToByteArray(int a) {
        return new byte[]{
                (byte) ((a >> 24) & 0xFF),
                (byte) ((a >> 16) & 0xFF),
                (byte) ((a >> 8) & 0xFF),
                (byte) (a & 0xFF)
        };
    }

    /*ref to http://stackoverflow.com/questions/4266756/can-we-make-unsigned-byte-in-java*/
    public static int unsignedBytes(byte b) {
        return b & 0xFF;
    }
}




Java Source Code List

com.example.android.SmartEPW.BluetoothChatService.java
com.example.android.SmartEPW.ControlEPW_Fragment.java
com.example.android.SmartEPW.Debug_Fragment.java
com.example.android.SmartEPW.DeviceListActivity.java
com.example.android.SmartEPW.Help_Fragment.java
com.example.android.SmartEPW.Home_Fragment.java
com.example.android.SmartEPW.MenuActivity.java
com.example.android.SmartEPW.ResideMenuItem.java
com.example.android.SmartEPW.ResideMenu.java
com.example.android.SmartEPW.util.ChartInitialization.java
com.example.android.SmartEPW.util.FormatConvert.java
com.example.android.SmartEPW.widget.VerticalSeekBar_Reverse.java
com.example.android.SmartEPW.widget.VerticalSeekBar.java