[[+content_image]]
L
L
LoonTiG2016-05-17 19:42:09
Python
LoonTiG, 2016-05-17 19:42:09

How to link "bytes getBytes()" in Java and "bytearray()" in python?

Hello ,
I was looking for an equivalent for byte[] getBytes()in python.
I understand that this is a bytearray, but getBytes() gives bytes like this:
[[email protected] (That is, 0x1ce59895 ???), and bytearray is 115 114 95 115 104 97 104
Like this to tie?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
Сергей Горностаев, 2016-05-17
@LoonTiG

String str = new String("Какая-то строка");
byte[] bStr = str.getBytes();

Чтобы "красиво" это распечатать
или
System.out.println(Arrays.toString(bStr));

D
Dmitry Alexandrov, 2016-05-17
@jamakasi666

The question is not clear.
What do you want to link exactly?
From python to transfer bytes to java?
or read bytes in java just like in python?
or read bytes in python as in java?
Where are you reading the bytes from?
How should bytes be represented for your task?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question