You probably want to go back and re-think your design, since it's generally a bad idea to mix type the way you are.
That being said, if that isn't an option for you, you'll need to check the type your object, then print the 'size' for each defined how you thing is appropriate:
public void printSize(Object o) {
if (o instanceof String) {
String s = (String) o;
System.out.println(s.length());
} else if (o instanceof byte[]) {
byte[] b = (byte[]) o;
System.out.println(b.length);
} else if (o instanceof Integer) {
Integer i = (Integer) o;
System.out.println(String.valueOf(i).length());
// and so on for other types
} else {
throw new InputMismatchException("Unknown type");
}
}