The byte data type
1.Add the code below to the onCreate method. This will create an empty array of the data type byte named myByteArray, allocating memory for 1024 bytes.
byte[] myByteArray = new byte[1024];
2. Compile and run!
3. Another example, to create and initialize a byte array to the letters 'h e l l o'.
byte[] myByteArray2 = {'h', 'e', 'l', 'l', 'o'};
Related Articles:
- Create a new FileOutputStream
- Declare an OutputStream
- Declare and Set a String Variable
- Declare an InputStream
- Reference a File on your Android Device