// Path: src/main/java/com/felhr/usbmassstorageforandroid/utilities/EndianessUtil.java
// public class EndianessUtil
// {
//     private EndianessUtil()
//     {
// 
//     }
// 
//     public static int swapEndianess(int i)
//     {
//         return((i&0xff)<<24)+((i&0xff00)<<8)+((i&0xff0000)>>8)+((i>>24)&0xff);
//     }
// }


import com.felhr.usbmassstorageforandroid.utilities.EndianessUtil;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
                                byte bmCBWFlags, byte bCBWLUN, byte bCBWCBLength)
    {
        this.dCBWSignature = CommandWrapper.CBW_SIGNATURE;
        this.dCBWTag = generateTag();
        this.dCBWDataLength = dCBWDataLength;
        this.bmCBWFlags = bmCBWFlags;
        this.bCBWLUN = bCBWLUN;
        this.bCBWCBLength = bCBWCBLength;
    }

    public void setCommandBlock(byte[] commandBlock)
    {
        this.commandBlock = commandBlock;
    }

    public int getdCBWDataLength()
    {
        return dCBWDataLength;
    }

    public int generateTag()
    {
        Random random = new Random();
        return random.nextInt();
    }

    @Override
    public byte[] getCWBuffer()
    {
        ByteBuffer buffer = ByteBuffer.allocate(CBW_SIZE);
// Path: src/main/java/com/felhr/usbmassstorageforandroid/utilities/EndianessUtil.java
// public class EndianessUtil
// {
//     private EndianessUtil()
//     {
// 
//     }
// 
//     public static int swapEndianess(int i)
//     {
//         return((i&0xff)<<24)+((i&0xff00)<<8)+((i&0xff0000)>>8)+((i>>24)&0xff);
//     }
// }


// Path: src/main/java/commandwrappers/CommandBlockWrapper.java
import com.felhr.usbmassstorageforandroid.utilities.EndianessUtil;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;

                                byte bmCBWFlags, byte bCBWLUN, byte bCBWCBLength)
    {
        this.dCBWSignature = CommandWrapper.CBW_SIGNATURE;
        this.dCBWTag = generateTag();
        this.dCBWDataLength = dCBWDataLength;
        this.bmCBWFlags = bmCBWFlags;
        this.bCBWLUN = bCBWLUN;
        this.bCBWCBLength = bCBWCBLength;
    }

    public void setCommandBlock(byte[] commandBlock)
    {
        this.commandBlock = commandBlock;
    }

    public int getdCBWDataLength()
    {
        return dCBWDataLength;
    }

    public int generateTag()
    {
        Random random = new Random();
        return random.nextInt();
    }

    @Override
    public byte[] getCWBuffer()
    {
        ByteBuffer buffer = ByteBuffer.allocate(CBW_SIZE);
        buffer.putInt(EndianessUtil.swapEndianess(dCBWSignature));