question: private static Object compressNonDecimal ( DataType changedDataType , double [ ] value , int decimal ) { int i = 0 ; switch ( changedDataType ) { case DATA_BYTE : byte [ ] result = new byte [ value . length ] ; for ( double a : value ) { result [ i ] = ( byte ) ( Math . round ( Math . pow ( 10 , decimal ) * a ) ) ; i ++ ; } return result ; case DATA_SHORT : short [ ] shortResult = new short [ value . length ] ; for ( double a : value ) { shortResult [ i ] = ( short ) ( Math . round ( Math . pow ( 10 , decimal ) * a ) ) ; i ++ ; } return shortResult ; case DATA_INT : int [ ] intResult = new int [ value . length ] ; for ( double a : value ) { intResult [ i ] = ( int ) ( Math . round ( Math . pow ( 10 , decimal ) * a ) ) ; i ++ ; } return intResult ; case DATA_LONG : long [ ] longResult = new long [ value . length ] ; for ( double a : value ) { longResult [ i ] = ( long ) ( Math . round ( Math . pow ( 10 , decimal ) * a ) ) ; i ++ ; } return longResult ; case DATA_FLOAT : float [ ] floatResult = new float [ value . length ] ; for ( double a : value ) { floatResult [ i ] = ( float ) ( Math . round ( Math . pow ( 10 , decimal ) * a ) ) ; i ++ ; } return floatResult ; default : double [ ] defaultResult = new double [ value . length ] ; for ( double a : value ) { defaultResult [ i ] = ( double ) ( Math . round ( Math . pow ( 10 , decimal ) * a ) ) ; i ++ ; } return defaultResult ; } }
target:  compress data to other type through sub value for example: 1. subValue = value * Math.pow(10, decimal) 2. subValue: double->int