Skip to content

Tag: java

X500Principal Distinguished Name order

I’m using the Bouncycastle lib to generate certificates from PKCS10 requests using the X509v3CertificateBuilder class. It returns build a X509CertificateHolder object which contains the generated certificate. If I call getIssuer on the holder, it returns the issuer distinguished name in the correct orde…

Extract statistics from google play

I’m building some statistics and would like to have the statistics from google play (the app store) as well. Information like most popular, downloads, price, etc. Does anyone know if there is an API for this or do I have to scrape it myself? Answer There’s a project called android-market-api http:…

how to store date AND time with JPA in Oracle?

I’m using WebSphere 7 (Java EE 5) and OpenJPA 1.2.1. I have a JPA object with a “modifiedTimestamp” attribute, something like this: The related field in the Oracle database is of type DATE. I set the date like so … … and it gets stored, but when I read it back the time of day has…

How do I convert a number to a letter in Java?

Is there a nicer way of converting a number to its alphabetic equivalent than this? Maybe something than can deal with numbers greater than 26 more elegantly too? Answer Just make use of the ASCII representation. Note: This assumes that i is between 1 and 26 inclusive. You’ll have to change the conditio…

how to convert short array to byte array

I have found converting a short to byte array, and byte array to short array, but not short array to byte array. Here is the code leading up to the conversion I have tried and However I receive this error on both (the error if not exactly the same but very similar for both): 05-29 13:41:12.021: W/AudioTrack(9…

sort an arraylist of arraylist of integers

I am looking to sort an arraylist of arraylist of integers and I require help? I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order… Answer No error check for null lists, but here it is. With Java 8 it gets even more concise:

Create QR-Code in vector image

I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS. How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter? Answer The easiest way I found was to create a PDF with iText and then convert the resulting PDF