Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package eu.mihosoft.vrl.user;
import java.text.NumberFormat;
import java.text.DecimalFormat;
@ComponentInfo(name="Vector2String", category="ODE")
public class Vector2String implements java.io.Serializable {
private static final long serialVersionUID=1L;
@OutputInfo(style="default")
public String print(@ParamInfo(name="Vector", options="serialization=false") double[] vector) {
DecimalFormat df = new DecimalFormat("0.0000")
StringBuilder sb = new StringBuilder();
sb.append("| ")
System.out.print("| ")
for (int i = 0; i < vector.length; i++) {
String entry = df.format(vector[i]).replace(",",".") + "\t"
sb.append(entry)
System.out.print(entry)
}
System.out.println("|")
sb.append("|\n")
return sb.toString()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment