Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am farhadfaghihi on github.
  • I am farhadfaghihi (https://keybase.io/farhadfaghihi) on keybase.
  • I have a public key ASCu1KC0BZZvHvKWn2j6SNy81ZUkm16-_e1eGFnOrkUlPAo

To claim this, I am signing this object:

@farhadfaghihi
farhadfaghihi / Recursion.java
Created May 5, 2017 16:10
Head vs. Tail Recursive
package ir.jibmib;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
try{
BigInteger result = tailRecFactorial(1000,BigInteger.valueOf(1)) ;
@farhadfaghihi
farhadfaghihi / GsonGenericsSample.java
Last active June 24, 2019 12:44
Demonstrating how to use Java Generic types with the Google's gson library
package io.github.farhadfaghihi;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
/**
* This project shows a sample code for using java Generic Types de/serialization,
* Google's gson library.
* The project is about consuming the responses from a webservice, which all of its
@farhadfaghihi
farhadfaghihi / DeviceUtils.java
Last active January 8, 2017 09:00
Detect if the application is running on Emulator, Genymotion or VM
public static boolean isRunningOnEmulator()
{
Boolean result = false;
if(
"google_sdk".equalsIgnoreCase(Build.PRODUCT) ||
"sdk_google_phone_x86".equalsIgnoreCase(Build.PRODUCT) ||
"sdk".equalsIgnoreCase(Build.PRODUCT) ||
"sdk_x86".equalsIgnoreCase(Build.PRODUCT) ||
"vbox86p".equalsIgnoreCase(Build.PRODUCT) ||