Reputation: 11
I have an algorithm written in Delphi and ask me to convert that to java equivalent.
It has a line of code that I can't understand, could anyone help me convert this line of code to java ?!
const list: array [1..37] of byte=(9,7,5,3,1,2,4,6,8,4,7,3,9,1,6,5,1,6,7,2,3,6,5,3,8,9,2,1,7,4,2,3,1,9,7,6,8);
Upvotes: 0
Views: 536
Reputation: 3109
First you will need to import Collection framework by declaring import java.util.*;
byte data [] = {9,7,5,3,1,2,4,6,8,4,7,3,9,1,6,5,1,6,7,2,3,6,5,3,8,9,2,1,7,4,2,3,1,9,7,6,8};
List<byte[]> list = new ArrayList<byte[]>(Arrays.asList(data));
// outputting your data
for(byte [] arrayOfByte : list){
for( byte element : arrayOfByte){
System.out.println(element);
}
}
If you don't want to use collection Framework then , simply :
byte list [] = {9,7,5,3,1,2,4,6,8,4,7,3,9,1,6,5,1,6,7,2,3,6,5,3,8,9,2,1,7,4,2,3,1,9,7,6,8};
Upvotes: 1