Convert array of strings into a string in Java

Java 8+ Use String.join(): Note that arr can also be any Iterable (such as a list), not just an array. If you have a Stream, you can use the joining collector: Legacy (Java 7 and earlier) Alternatively, if you just want a “debug-style” dump of an array: Note that if you’re really legacy (Java 1.4 and earlier) you’ll need to replace StringBuilder there with StringBuffer. Android … Read more

Sleep function in C++

Use std::this_thread::sleep_for: There is also the complementary std::this_thread::sleep_until. Prior to C++11, C++ had no thread concept and no sleep capability, so your solution was necessarily platform dependent. Here’s a snippet that defines a sleep function for Windows or Unix: But a much simpler pre-C++11 method is to use boost::this_thread::sleep.

Gradle does not find tools.jar

Found it. System property ‘java.home’ is not JAVA_HOME environment variable. JAVA_HOME points to the JDK, while java.home points to the JRE. See that page for more info. Soo… My problem was that my startpoint was the jre folder (C:\jdk1.6.0_26\jre) and not the jdk folder (C:\jdk1.6.0_26) as I thought(tools.jar is on the C:\jdk1.6.0_26\lib folder ). The compile line in dependencies.gradle … Read more

What is difference between arm64 and armhf?

armhf stands for “arm hard float”, and is the name given to a debian port for arm processors (armv7+) that have hardware floating point support. On the beaglebone black, for example: Although other commands (such as uname -a or arch) will just show armv7l The vfpv3 listed under Features is what refers to the floating point support. Incidentally, armhf, if your processor supports it, basically supersedes Raspbian, which … Read more

error: cannot lock ref.. ‘refs/tags’ exists; cannot create ‘refs/tags/

Your Git is complaining that a reference (rather than a directory) named refs/tags exists. It’s not clear what would create that, but see if git rev-parse refs/tags produces a hash ID. If so, that reference needs to go away: after which git fetch should work. If git rev-parse refs/tags fails (which it should—refs/tags itself should not be a valid name) then this is not the problem and it’s … Read more

Error: A JNI error has occurred, please check your installation and try again – during running Java program from Ubuntu terminal

The error says it all: Exception in thread “main” java.lang.UnsupportedClassVersionError: Test has been compiled by a more recent version of the Java Runtime (class file version 55.0)… You’ve compiled for Java 11 … but you’re running an older JRE (Java 8). SUGGESTIONS: recompile with -source and -target to target an earlier version of Java in your .class file, or … Read more