There is no BITAND function, but you can work around it using MOD
(
(
$Bit24/Value -
(
$Bit24/Value mod
pow( 2, 24-1 )
)
)
div
pow( 2, 24-1 )
) mod 2 > 0
Thanks to Mathematically get n th bit from integer
As far as I can tell, this is not possible in Mendix, but you can create a Java action that will do this for you.
Okay, I have inserted an integer parameter in the Java action in Mendix (for the input from the microflow).
I think I should be able to use it in the Java file, but I can't find it. Here is an excerpt of the file:
package myfirstmodule.actions;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
public class ConvertIntToByte extends CustomJavaAction<java.lang.Boolean>
{
private java.lang.Long Parameter;
public ConvertIntToByte(IContext context, java.lang.Long Parameter)
{
super(context);
this.Parameter = Parameter;
}
@java.lang.Override
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
throw new com.mendix.systemwideinterfaces.MendixRuntimeException("Java action was not implemented");
// END USER CODE
}
/**
* Returns a string representation of this action
* @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "ConvertIntToByte";
}
I want to do it with this in the java file:
// Convert integer to byte
byte byteValue = (byte) integerValue;
// read out 24th bit
byte bitMask = (byte) (1 << 7);
byte extractedBit = (byte) ((byteValue & bitMask) >>> 7);
but i dont know where i get the integerValue from and how i can return the boolean value, the file contains the above code