Get object sharing setting on Organization-Wide Defaults
For the Standard object, you can use Organization object to achieve this, query like,
Organization org = [Select Id, DefaultAccountAccess, DefaultContactAccess, DefaultLeadAccess, DefaultOpportunityAccess from Organization];
System.debug(org);
Query this object to obtain information about an organization's settings. Only one organization
record exists per organization.
for the details, see the doc, http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_organization.htm
Another way to test for sharing of custom objects is to check the global describe Map.
Map<String, Schema.SObjectType> tokens = Schema.getGlobalDescribe();
if(tokens.containsKey('MyCustomObject__Share')) {
//Share object exists, therefore custom object is private or public read only
//Still need to use dynamic apex because this code won't compile if MyCustomObject__Share does not exist
SObject share = tokens.get('MyCustomObject__Share').newSObject();
share.put('ParentId', customObjectInstance.Id);
share.put('UserOrGroupId', UserInfo.getUserId());
//API Name of the Sharing reason, or don't populate if the reason is Manual
share.put('RowCause', 'Sharing_Reason__c');
} else {
//Share does not exist custom object is public read write
}
As you have already discovered, this is only for custom objects, @JiaHu's answer explains how to get the sharing level of a standard object.