FAQ Database Discussion Community

How to replace all String.equals by StringUtils.equals

I want to automatically replace all occurrences of if(variable!=null && variable.equals(value)) ... by if(StringUtils.equals(variable, value)) ... in a type-aware manner. That means, that variable and value should be sure to be String (not just lexicographical processing, eg. with awk/perl). Also it should be flexible enough to apply for value as...

Translating Stata to R: collapse

Just came across a .do file that I need to translate into R because I don't have a Stata license; my Stata is rusty, so can someone confirm that the code is doing what I think it is? Here's the Stata code: collapse (min) MinPctCollected = PctCollected /// (mean) AvgPctCollected...

Converting CRC 8 function written in C to Java

I am trying to translate a CRC8 function from C to Java. I got this code from the hardware manufacturer: uint8_t CRCCalc (uint8_t* pointer, uint16_t len) { uint8_t CRC = 0x00; uint16_t tmp; while(len > 0) { tmp = CRC << 1; tmp += *pointer; CRC = (tmp & 0xFF)...