Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • why does your string have null terminating characters in the middle of it? It sounds like you are using the wrong container for your data. Commented Dec 4, 2014 at 20:51
  • We're essentially turning an array of doubles into a string, so sections of the double bytes are the same as the null char. I can't just print out the doubles and put it as an ascii string, thet's way too slow, and has whitespace and other not-necessary things. Commented Dec 4, 2014 at 20:54
  • 3
    Strings, both in C++ and Java, are meant to store things relevant to natural language. If you need to move doubles to a buffer of some sort, you should be using a vector<char> in C++ and jbyteArray on the Java side. No strings. Using NewStringUTF is especially bad, since the JVM will transform your buffer to UTF, thinking you are passing it a string. Commented Dec 4, 2014 at 20:57
  • 1
    @RedAlert Actually, NewStringUTF is for modified UTF-8, which isn't a Unicode Consortium format. Commented Dec 6, 2014 at 0:11