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