```
public boolean isStrobogrammatic(String num) {
if (num == null) return false;
int i = 0, j = num.length() - 1;
while (i <= j) {
if (!isSG(num.charAt(i++), num.charAt(j--))) return false;
}
return true;
}
private boolean isSG(char a, char b) {
if (a == b) return a == '1' || a == '0' || a == '8';
return a == '6' && b == '9' || a == '9' && b == '6';
}
```