java - Convert String to byte[] array -


i want convert string byte array array must have 256 positions, mean, this:

public byte[] temporal1 = new byte[256]; public byte[] temporal2 = new byte[256]; 

so, when do:

string send = "send_message"; string sendack = "send_message_ack"; temporal1 = send.getbytes(); temporal2 = sendack.getbytes(); 

i error: "./th.java:24: error: <identifier> expected". know if public byte[] temporal1 = send.getbytes();it works, need array size compare other byte array byte byte.

can please show exact exception or error occurring in console. because works fine me.

byte b1[] = new byte[256]; string s = "hello there"; b1 = s.getbytes(); system.out.println(b1); 

Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -