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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -